-
Notifications
You must be signed in to change notification settings - Fork 33
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 refresh in middleware causing issues #1184
Comments
And in the case of using the nextjs library version, with a custom UI, is it possible to use to use |
For your first question, there's not a lot to go on with what you've provided. I suggest adding more logging to see what the problem might be. As for the Next.js library, it will currently only work if you use AuthKit rather than your own UI. When using your own UI we recommend using the Node SDK instead. |
Hey Paul, the reason is
To achieve a custom UI + nextjs middleware, with the node sdk, I would need to do all this header manipulation too right? Would an option be to use the authkit middleware without Using the authkit middleware eliminates issues with manual refreshing/header manipulation etc. (Session is available in route handlers etc) |
Could you confirm if this example actually works? I am getting really strange results here. Debug logs say session is valid, but when I check The debug logs from the middleware say there is a session. https://github.com/workos/authkit-nextjs?tab=readme-ov-file#retrieve-session-in-middleware |
I'm running into a similar issue with an |
@kevinmitch14 Are you using the provided middleware or are you using your own custom middleware with custom UI? @DarrylBrooks97 You should receive a description alongside that error that will give more clues as to what's going on. i.e. "Refresh token already used". Can you share the description? |
My issue turned out to be that setting a cookie using the |
@PaulAsjes, I found the only mention of the |
Hi,
We are using the Node SDK in our nextjs application. We are running into issues in relation to refreshing the tokens in middleware.
Basically, when using something like tanstack query, and refocusing on the window, it will refetch the queries. We have some queries pointing to our API route handlers. This works okay, until the token needs to be refreshed, it then seems that my custom assert session helper doesn't pick up the session. Any ideas as to why?
This is working perfectly, until the refetch on window focus occurs and refresh token needs to be refreshed
This is what I'm observing in the logs
The text was updated successfully, but these errors were encountered: