Closed erosRCS closed 2 months ago
I have the same problem!
The refresh request, manually triggered, sends refreshToken: null
as body which causes a 400 error from my backend API.
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 have the same problem!
The refresh request, manually triggered, sends
refreshToken: null
as body which causes a 400 error from my backend API.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
Environment
Reproduction
Have the following auth configuration
Sign in using signIn composable from useAuth
In a protected page, use a custom auth middleware
Try to get the refresh token using useAuth, and useCookie from Nuxt
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