Is it possible to pass access tokens to react server components?

I have an access token that's stored in local storage. Using the access token in client components is no problem since it has access to window, but for react server components this isn't the case. Is there a way to pass in access tokens into react server components? Such as through a custom header?
2 Replies
xiii163
xiii16313mo ago
maybe a cookie would solve it.
Sz
SzOP13mo ago
How would the cookie be passed into the server component? I've been reading this article that states something similar as well by using routes api or middleware, but still a little confused as to how the react server component would be able to have access to the cookies or headers set from the routers or middleware article in question: https://www.propelauth.com/post/5-common-pitfalls-with-server-components-in-next13-with-examples
PropelAuth Blog
5 Common Pitfalls with Server Components in Next13 (with examples)
The App Router is a new feature in NextJS 13, and it was recently switched to being the recommended option when you create a new NextJS application. This effectively replaces the Pages Router, and NextJS has documentation on how you can incrementally switch over. The most notable difference in the
Want results from more Discord servers?
Add your server