Replies: 1 comment 2 replies
-
I don't think this is related to urql at all fwiw But, you should be able to read the Next route location universally. That depends though on how you initialise your urql Client. Either you'll have access to the "page context" object, or you'll be able to use the Also, just to point this out, I'm not sure how you add the bearer token to the URL, but it's probably worth mentioning that I wouldn't just put it in the URL. Rather, I'd make sure that it's never sent back to the server, e.g. either by adding a token exchange process on the client-side, or by adding it only to the hash part of the URL, so it's client-side-only. Otherwise you'd lose a lot of the benefits over cookies and keeping that token in a non-JS/secure space. Anyway, I'm just assuming you're trying to make an OpenID-like PKCE redirect signin flow. Also, I'm not sure what the actual error handler is for and why it'd concern auth + logging in. Presumably, your auth flow, if the user is not logged in has the ability to log the user back in via a cookie refresh mechanism? Why, if the cookie is sent, would the access token not be a cookie? Or alternatively, if cookies are explicitly not desired, why wouldn't this be an API-only refresh mechanism? Anyway, just pointing out there's a lot of questions here for which only you can determine the answer to, but I don't think any of this really can be answered "by urql", so to speak 😅 ❤️ |
Beta Was this translation helpful? Give feedback.
-
Hi, I need to access
window.location
properties in urql client. However, since Next.js renders stuff on server side, some of these might not be defined always. How do I access these or similar properties on server side via Next.js? Such aswindow.location.search
andwindow.location.pathname
,window.origin
etc. I have for example an error handler that redirects if the user is not logged in and need to access token from the url and attach it as a bearer header etc.Beta Was this translation helpful? Give feedback.
All reactions