Skip to content
Back

Retrieving user access token on client side from the cookies

  • 0
  • General
  • Web
Rehman
19 Jun, 2025, 10:03

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 unable to retrieve the user token from HTTP-only cookies on the client side. One solution is to create a new endpoint on the back-end that accepts the user token as a parameter and returns it in the response headers. This way, the front-end can make a request to the new endpoint and retrieve the user token, which can then be included in the headers of external API requests for authentication.
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