Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong Example in the documentation #22

Open
reza305z opened this issue Oct 15, 2022 · 0 comments
Open

Wrong Example in the documentation #22

reza305z opened this issue Oct 15, 2022 · 0 comments

Comments

@reza305z
Copy link

Hi!
In the documentation, There is an example for new session when user is logging in:

public function newSession(Request $request) {
    //Insert the session into the telegram_sessions table

    $user = User::find($request->get('user_id'));
    
    $telegramSession = $user->telegramSession()->create([
        'session_file' => "{$user->name}.madeline"
    ]);
    
    //You can either use one of this following method

    $madelineProto = $this->factory->get($telegramSession);
    //or
    $madelineProto = Factory::get($telegramSession);

    $madelineProto->phoneLogin($request->get('phone_number'));

    return response()->json([
        'message' => 'Phone code sent!'
    ]);
}

At the beginning of the function, It gets user_id from the request.
If we know the user_id, Why do we need to authenticate the user?

Assuming that the laravel application uses telegram authentication api to authenticate its users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant