C
C
ClaraOswald2017-02-12 22:50:12
User identification
ClaraOswald, 2017-02-12 22:50:12

How to make authorization for applications on laravel Passport?

How to authorize external users on Laravel in the application i.e. give them a Personal Access Token?
At the moment it is implemented as follows.
There is a standard route /oauth/token. The following parameters are passed to it via a post request:
1) grant_type = 'password'
2) client_id from the oauth_clients table, Laravel Password Grant Client user id
3) client_secret = from the oauth_clients table, secret of the Laravel Password Grant Client user
4) username = user login
5 ) password = user password
as a result of the response, we get the data we need (token).
This method requires stitching data 2 and 3 into the application, I'm not sure if this is a good idea.
Alternatively, you can write a method that will issue a token using $user->createToken('mobile1')->accessToken, but this idea seems to me not the best.
Therefore, the question is how to issue an authorization token to the application user as correctly as possible?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question