Closed mbellamyy closed 1 day ago
@phoenix-ru Hey Phoenix sorry to ping, I see you started working on a PR regarding this, is this something you are still working on? I am facing a similar issue as above and I believe your PR would fix that issue :)
I am sadly not experienced enough to figure out if I could help with anything in your PR, as I can barely understand what's going on :D
Hi @ThomasSimonsen20 , I was on a vacation :slightly_smiling_face: I will possibly come back to this in 2 days or next week, as it's awaiting review from @zoey-kaiser
Thank you for the update, hope you had a nice vacation :)
Hi @mbellamyy and @ThomasSimonsen20 👋
Sorry for the ping, but I wanted to quickly let you know that we have just released https://github.com/sidebase/nuxt-auth/releases/tag/0.8.0-alpha.3 in which you can now define your own custom refresh logic! Feel free to check out the release notes for more information!
Environment
Build Modules: -
Reproduction
not needed, code is obvious
Describe the bug
This is actually two issues.
First issue is here. Let's assume
refresh
provider is chosen.https://github.com/sidebase/nuxt-auth/blob/faa039b72da2c64d9c214f0502dea053c7a4ff84/src/runtime/utils/refreshHandler.ts#L43-L62
We're creating two intervals. One of them is calling
getSession
and the other is callingrefresh
. But therefresh
implementation callsgetSession
at the end itself... So the first interval might be redundant for refresh? I know the interval times are different. So this is not a hugely imporant part of this issue.Now the second (and more important) part of the issue:
https://github.com/sidebase/nuxt-auth/blob/faa039b72da2c64d9c214f0502dea053c7a4ff84/src/runtime/utils/refreshHandler.ts#L22-L29
This function is the tab refocus refresher. It is calling
getSession
which is acceptable in thelocal
provider, but forrefresh
I think it should callrefresh
, which in turn callsgetSession
later. If the token is expired (but can be refreshed), this method is missing it and logging the user out.Additional context
No response
Logs
No response