Open axdemelas opened 6 years ago
You need to login once and use that token until it expires for the api requests. Once it expires you need to refresh the token by providing the old token, which will give you a new token for the same amount of time. You can store the token in local storage or cookies for persistence.
You need to login once and use that token until it expires for the api requests. Once it expires you need to refresh the token by providing the old token, which will give you a new token for the same amount of time. You can store the token in local storage or cookies for persistence.
Yeah, but then you will have to send the Bearer token with each call right? So, I log in my user with Web Guard, then what will happen if I want to use the api from within? Let the user type his username and password again?
+1 i think i found a good reason to use passport
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
I'm using Laravel 5.6 with jwt-auth for API Authentication. The idea behind it is simple:
But if the API consumer is my own JavaScript? Should I also login when starting each asynchronous request even if already knows the authenticated user in my web middleware? How people usually manage this?
With Passport (OAuth2.0), Laravel delivers a middleware that injects a cookie with authorization token, making this process automatic and easy:
Read more.
How to use JWT (this package) and make requests to my own application's API without explicitly passing an access token?