-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refresh token #11
Comments
At the moment there is no "in-built" way to do this for you. It would have to be done manually for now. One way would be to create a refresh endpoint that would accept an expired token. You would then validate the token and payload claims (excluding the expiry) and issue a new token. I am currently working on the develop branch and this will be built in. |
Look at https://www.youtube.com/watch?v=eWUkxzyB1Rk He is using redis for expire of token. This is good because the is no need for sql query. Only for first time. So it will be cool to have options sync with redis:D Thanks a lot. |
uuu i see you are using jti from example:D Very niceeeee man:D |
Does it support for laravel 5 |
Yes I plan to support both laravel 4 and 5 with the upcoming release. There will be a filter and middleware 👍 |
I wrote a simple "after" filter that generates a new token and sets it in the response header.
// accepts a User, and returns a token
In every successful response that needs authorization, this new header is added. On the client side, an angularjs interceptor updates the global "Authorization" header value. This enables you to set a very low token expiration time and then keep on extending it till the user is inactive for more than 5 mins or 10 mins on the app. This would be much simpler if there were a new method that does not touch the database. JWTAuth::toUser($token): This method goes to the database and makes it less effective to call in the after filter. |
i agree with yanilkr :D |
Thanks guys, I think I will implement this into a separate middleware, (sending a new token with every response) so it will be the developers choice to use it |
RefreshToken Middleware added :) |
Hi. What method can help me to generate refreshed token manualy? |
@hotrush You can do one of the following: $oldToken = 'foo.bar.baz';
$newToken = JWTAuth::refresh($oldToken);
// or
$newToken = JWTAuth::parseToken()->refresh();
// or
$newToken = JWTAuth::setToken($oldToken)->refresh();
// etc |
I cant recresh the token if it's expired. maybe I 'm wrong , but it would have to be able to refresh the token while refresh_ttl time is not expired ? |
@tymondesigns thanks, i will try |
What is the best way to implement the Laravel 5 Middleware style in Laravel 4? |
Hi @yanilkr, rather old issue I know but any chance to see what your response interceptor looks like in AngularJS? I am using the return {
"response": function(response) {
// only contains "content-type" and "cache-control"
$log.log(response.headers());
return response;
}
} My research's been unsuccessful so far! Thanks |
Never mind, finally found the answer. When using CORS, you need to specify to which headers the client will have access, using the http://stackoverflow.com/questions/25673089/why-is-access-control-expose-headers-needed |
…t-issues Fix dependant bot vulnerability check for github.
What about refresh token?
I m using angular and i want to refresh token. How to do this?
The text was updated successfully, but these errors were encountered: