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.