S
S
StrangeGoogle2020-01-05 03:14:07
OAuth
StrangeGoogle, 2020-01-05 03:14:07

REACT with LARAVEL. How to do correctly and competently authorization?

Hello! I ask you to tell me about the correct implementation of the React application authorization in conjunction with LARAVEL PASSPORT. I don't really understand passport.
1. What should we get from the backend (LARAVEL PASSPORT) upon successful authentication?
In most examples, there is a user cell in localStorage. But I don't understand why you need to store user data there. Explain, please.
2. If our access token has expired, what should we do and how?
3. Index.js - how to check if the user is authorized and how to check the validity of the token.
Tell us more about everything, please.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
JhaoDa, 2020-01-05
@JhaoDa

Laravel Passport is an implementation of OAuth, you don't need to understand Passport, just understand OAuth and read the documentation.

1. What should we get from the backend (LARAVEL PASSPORT) upon successful authentication?
This is stated in the OAuth specification and in the Passport documentation.
2. If our access token has expired, what should we do and how?
This is stated in the OAuth specification and in the Passport documentation.
3. how to check the validity of the token
By making a request with this token to the backend or by looking at its lifetime. This is also stated in the OAuth specification and in the Passport documentation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question