1

I have read some tutorials and video tutorials and they explain how to create a api_token.

I know that I have to change the AuthController and I have to add a new field which it is api_token when a new user registers. I know that I have to add auth middleware in the routes, etc.

But what I dont understand is this...

1) A new user registers in the app. 2) The app create to the user an api_token automaticly.

but I wonder how this user will know which it is its api token because if this user turns off the computer and then it returns to the app how will this user know what it is its api token again? because he will not register again.

Thanks.

1
  • 1
    Token is hashed in browser cookies, and when ever user starting a request again, this token is sent to server automatically Commented Oct 28, 2017 at 15:07

1 Answer 1

1

Have a look at Laravel Passport. Laravel Passport uses for instance an OAuth autherization. If you log in your application you get an access token and a refresh token. The access token is self explaining you basically get access to the application, the refresh token does refresh you access after a specific amount of time that value is typically written in a configuration file.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.