Skip to content
Back

Retrieving user access token on client side from the cookies

  • 0
  • Self Hosted
Shuraim
17 Jun, 2025, 15:37

I am trying to retrieve the user token from the cookies, but they are HTTP-only and can not be accessed. Is there a way to extract the user token from the cookie and include it in the headers of external API requests? My back-end is written in Go and uses an authentication middleware to protect the routes. The token is required in the headers for authentication.

TL;DR
Developers are struggling to retrieve the user access token from HTTP-only cookies for including it in headers of API requests. Their back-end, written in Go, uses authentication middleware. Solution: One way to pass the token could be to send it as a query parameter in the URL instead of as a header. Another option could be to have the back-end send the token to the front-end via an endpoint specifically for retrieving the token.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more