-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Token immediately blacklisted #983
Comments
Note: I can make the error go away by adding this to my
But this does not feel like a "fix"... This feels like I have just made the problem go away without actually solving the cause ;) |
Hi @njt1982 , I am no expert, but I was just poking around in the code in this area. And the code that does the refresh (Manager->refresh) will blacklist the token immediately if you have that enabled, making the tokens "one use only".
The refresh middleware seems to only be something you would use if you were doing one use tokens. Again, I'm no expert, currently poking around the code trying to figure out the right way to add refresh to my project. |
i have this issue too |
@njt1982 Are you storing the refreshed token? |
Encountered the same problem, @njt1982 don't konw if this is still a problem, but for anyone else in this situation. From the wiki
So it is by design. From my understanding, you won't be able to combine |
I was having the same issue. Was able to overcome it not by setting
Like @njt1982 mentioned as that would open up a vulnerability but I set the
Solved the issue of tokens dying for me and kept the security of having a blacklist |
Okay this only fixed the issue for 30 seconds for me delaying the inevitable I now have two options as I see it.
Thoughts? |
Okay the solution for me was the following. I was even able to change the I changed my refresh api endpoint from
to
This prevents the endpoint being cached by the browser which means that the new/refreshed token is always received. |
having all of these issues as well, @garhbod's cache method sort of worked but I can still get my token blacklisted sometimes when trying to refresh it. |
@acidjazz What frontend are you using? Are multiple requests happening at once? |
@garhbod nuxtjs, I don't think so, I can duplicate the blacklisting event by manually logging in, waiting for it to expire and hitting /refresh either with my browser or postman |
please note that you can change config options in your codes in run time. I used this code and this was a solution for me:
|
@ivahidmontazer where to change there ? |
You can change this config in your controllers or everywhere else, run time . |
I have used this but not work
…On Sat, Dec 15, 2018, 02:50 Vahid Montazer ***@***.*** wrote:
please note that you can change config options in your codes in run time.
I used this code and this was a solution for me:
config([
'jwt.blacklist_enabled' => true
]);
auth()->logout();
JWTAuth::invalidate(JWTAuth::parseToken());
@ivahidmontazer <https://github.com/ivahidmontazer> where to change there
?
You can change this config in your controllers or everywhere else, run
time .
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#983 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/Aj_EwctcWst5U6kAuf5d2cha4Nhxottlks5u5B0ZgaJpZM4LwqTX>
.
|
I had same problem specially when using multi auth with jwt. You can use a |
nothing work i am using this code in my controller on run time try
{
config([
'jwt.blacklist_enabled' => true
]);
\Cookie::forget(JWTAuth::parseToken());
auth()->logout();
JWTAuth::invalidate(JWTAuth::parseToken());
return response()->json(['message' => 'Successfully logged out']);
}
catch (Exception $e)
{
return response()->json(['message' => 'There is something wrong try again']);
} |
I set |
then what is the good of using return response()->json(['message' => 'Successfully logged out']); this code is catch section this way it shows only logout message my aim is not to show only message but logout the user as well |
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. |
Yes, it's still relevant and not fixed. |
O opened PR #2139 to try to solve this issue and mitigate this exception and make it optional for us. |
@tymondesigns can you review my PR #2139? Thank you. |
I'm upgrading my Laravel 5.2 app to Lumen 5.4 and have managed to repair my app to a point where I can at least log in again ;)
So on login, I get a token back and my Angular app stores it and makes 3 API requests with it. These all work perfectly.
Then I click something to make another request. This request fails with:
I can confirm the correct header is being sent:
I get 2 stack traces... 1/2 is this:
Then 2/2 is this:
As you can see in there, I am using
jwt.auth
andjwt.refresh
middleware...Any tips?
The text was updated successfully, but these errors were encountered: