-
-
Notifications
You must be signed in to change notification settings - Fork 176
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
refreshToken used in custom middleware returns null #896
Comments
I have the same problem! The refresh request, manually triggered, sends In my case I can't use this lib to do my authentication because the refresh feature doesn't work well.. I also tried to use a lighter configuration as possible (I have an issue on this repo with more details) but even in 0.8.x version, it seems to be not really stable 🥲. I think it's a problem about an element in the config that must be forced to set (like the default value is not set). I already found a similar problem like this in the past with this lib. But I tried many different configuration 😥. I hope we found the mistake because I really like the initiative of this library 😊 |
I see, didnt know it was an already old problem. And same as well! I like the library, so hopefully it is an easy fixable bug, or in any case something that can be done with the config files. |
Hi @erosRCS , thank you for a good reproduction! I will take a look into that today |
@phoenix-ru I was just working on implementing refresh token and I noticed that this fix is causing issue in case there is an error in refresh-token.server.ts (for example refresh token is invalid). In case of error, rawRefreshToken should be set to null and stay null but it is being overwritten with invalid refreshToken stored in cookie on line: |
Environment
Reproduction
Describe the bug
refreshToken is returned as null, even thought the cookie does exist, as proved by it existing when using refreshToken with useCookie. This is before its max age is reached. This makes it so that if i want to call the refresh() method from useAuth, it will fail, because a null value will be sent instead of the actual refreshToken. What could be a workaround for this?
Additional context
Im currently trying to define a custom logic to get the access and refresh tokens using this library. For testing, i setted the max age for the access tokens to be just 10 seconds.
For extra context, this problem doesnt happen with the access token, before its 10 seconds mark, which is the expected behaviour as told by the documentation. It only happens with refreshToken for some reason.
Logs
No response
The text was updated successfully, but these errors were encountered: