You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the with-next example from the github repository.
I need to query a graphql endpoint (Wordpress in this. case) where I'm logged in. I therefore need to attach credentials to the request. I've installed js-cookie and have amended the code in app/non-rsc/layout.tsx to include the code to get the cookie:
When this code runs on the server as part of the SSG run, the token is undefined and I don't get the authenticated content.
I've tried various ways to get the token on the server, but in next getting cookies is an async operation, so at best I get a promise I can't resolve as Layout.tsx is a client component and so not async.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm using the with-next example from the github repository.
I need to query a graphql endpoint (Wordpress in this. case) where I'm logged in. I therefore need to attach credentials to the request. I've installed js-cookie and have amended the code in
app/non-rsc/layout.tsx
to include the code to get the cookie:When this code runs on the server as part of the SSG run, the token is undefined and I don't get the authenticated content.
I've tried various ways to get the token on the server, but in next getting cookies is an async operation, so at best I get a promise I can't resolve as Layout.tsx is a client component and so not async.
Any suggestions would be greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions