U
U
Urbansamurai2017-02-06 00:27:57
OAuth
Urbansamurai, 2017-02-06 00:27:57

What is the algorithm for registering new users in Laravel Passport?

I am writing a web service with a separate back-end on Laravel. I set up Passport, implemented authorization, everything is more or less ok. But with the registration of new users it is not very clear what to do. There are two options:
1) In the post request I send the data of a new user, on the server I enter them into the users table, in the response I issue a token created in this way:

$token = $user->createToken('Token Name')->accessToken;
. A new user is registered in this way, but there is a problem: the expiration date of this token is not known, as in the case of the response from the request to /oauth/token .
2) In a post request, I send the data of a new user, on the server I add them to the users table, return them in the success response, initiate a new request on the client already to /oauth/token and get a full response with access_token, expires_in, refresh_token I'm a little lost on
how best to proceed, maybe I didn’t fully understand the nuances of OAuth2.0 and I don’t know something. Please tell me how to be?

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