Replies: 3 comments 1 reply
-
This seems more like a next.js usage issue rather than an urql one. We want to keep willAuthError synchronous as it intends to be a synchronous pre-cursor to an operation. You could however create your exchange inside of a component that leverages a mutable ref to track your token. I do see that as a more holistic solution as you'd want synchronous access to this anyway in different parts of your application to be strict on when and what to render. The fact that a redirect does not work can probably be similarly solved, where this component where you create your auth boundary imports whatever routing hook next uses and leverage that in the exchange. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the response @JoviDeCroock. Do you have an example as I'm not entirely sure what you mean? I think I could envisage something like that in a client component, but not in a server one, and that's where the issue is. |
Beta Was this translation helpful? Give feedback.
-
I don't really use server components, I could find the |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
I'm combining the code from the next-js example and the with-refresh-auth example using NextJS 15.
NextJs makes all actions on cookies asynchronous and also makes it impossible to manage cookies outiside of a route handler or server action. This means that the functions in authExchange can no longer handle cookie functionality, namely:
I'm pasting in my example code from authExchange, where there are comments labelled "ISSUE" that show where the problem occurs:
Reproduction
https://github.com/linucks/urql-authexchange-nextjs
Urql version
urql v5.1.0
urql/exchange-auth v2.2.0
urql/next v1.1.3"
Validations
Beta Was this translation helpful? Give feedback.
All reactions