How to set server-side cookie from API response
Unanswered
Oriental Scops-Owl posted this in #help-forum
Oriental Scops-OwlOP
Hi. i am fetching API response with fetch for logging into my API. the api returns set-cookie headers on the response.
How do i go about setting these cookies on server-side from the response, so the next call i make, the cookie is passed in from server-side?
I am able to retrieve the set-cookie values with getSetCookie() but not sure how to use this response to set the cookies on server-side
How do i go about setting these cookies on server-side from the response, so the next call i make, the cookie is passed in from server-side?
I am able to retrieve the set-cookie values with getSetCookie() but not sure how to use this response to set the cookies on server-side
6 Replies
Oriental Scops-OwlOP
i receive the following array:
[
'_grubstack_access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmcmVzaCI6ZmFsc2UsImlhdCI6MTcxMjY4MTk0MCwianRpIjoiZWNhNGQ0NGMtZmU4My00YzVkLTg2MzMtYTUwYWU1NTU4YWVhIiwidHlwZSI6ImFjY2VzcyIsInN1YiI6IjliNDZiOWY0LWM2ZTUtMTFlZS05NTExLWFmZTE2ZmQ1YjRhMSIsIm5iZiI6MTcxMjY4MTk0MCwiZXhwIjoxNzEyNjg1NTQwLCJpZCI6IjliNDZiOWY0LWM2ZTUtMTFlZS05NTExLWFmZTE2ZmQ1YjRhMSJ9.emnQ4X31HA0x8nyEBUrjfi2_vU60gHsMiizbRZwOrEw; Domain=grubstack.app; Secure; HttpOnly; Path=/; SameSite=None',
'_grubstack_refresh_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmcmVzaCI6ZmFsc2UsImlhdCI6MTcxMjY4MTk0MCwianRpIjoiNGYxYTE5ZDgtMTU0Yy00MzI5LTlkZjQtMWM0ZDNlYzAyOTFiIiwidHlwZSI6InJlZnJlc2giLCJzdWIiOiI5YjQ2YjlmNC1jNmU1LTExZWUtOTUxMS1hZmUxNmZkNWI0YTEiLCJuYmYiOjE3MTI2ODE5NDAsImV4cCI6MTcxNTI3Mzk0MCwiaWQiOiI5YjQ2YjlmNC1jNmU1LTExZWUtOTUxMS1hZmUxNmZkNWI0YTEifQ.y3fJ8K_D9gtaxCo0173JS4L9yt_tql61IH3wJdH2Alw; Domain=grubstack.app; Secure; HttpOnly; Path=/; SameSite=None']not sure of an easy way to parse this or if there is some kind of native function i can pass this array into to set the cookie on server-side
or should the cookie already be setting itself on the server-side from the fetch() call to my API ?
Oriental Scops-OwlOP
i think i may have figured out part of it..
Oriental Scops-OwlOP
cookies seem to be setting in backend.. now trying to utilize them :/
k i got it.. sorry again.. seems like alot of work though to get this going