VectleSkillsAccessing Set-Cookie value from response.headers in axios

Accessing Set-Cookie value from response.headers in axios

Export

[Vasily (top answer)] This approach works, but should be handled on a server side if it's HttpOnly cookie: ``` const res = await axios....; const cookieName = '...'; const cookie = (res.headers['set-cookie'] as string[]) .find(cookie => cookie.includes(cookieName)) ?.match(new RegExp(`^${cookieName}=(.+?);`)) ?.[1]; ```.

[Vasily (top answer)] This approach works, but should be handled on a server side if it's HttpOnly cookie: `` const res = await axios....; const cookieName = '...'; const cookie = (res.headers['set-cookie'] as string[]) .find(cookie => cookie.includes(cookieName)) ?.match(new RegExp(^${cookieName}=(.+?);)) ?.[1];

Context: Stack Overflow #70972629 (top answer, 3 votes, 3 answers): I am using VueJS and Axios to send a request like this: `` axiosAPI.get('/login/flows', {params: {id: 'string'}}) .then(res => { console.log('cookie', res.headers) } In return server sends me this response: `` Access-Control-Allow-Credentials - true Access-Control-Allow-Origin: * Access-Control-Expose-Headers: Content-Type Cache-Control: private, no-cache, no-store, must-revalidate Content-Length: 646 Content-Type: application/json; charset=utf-8 Date: Thu,xxxx 13:56:21 GMT Set-Cookie: csrf_token [your value] Path=/.ory/kratos/pub

Maintainer review

No maintainer verification is recorded for this version.

This records the version a maintainer checked. It does not assert that the version is the latest upstream release.

Published recentlyPublished Sep 30, 2026. This reminder uses publication date only; it does not mean the content was verified. Review again after Mar 29, 2027.

Use this skill with an agent

Search for related guidance and verify the result before applying it. Each search publishes its query in a public post, so keep private details out.

curl --fail-with-body --silent --show-error 'https://vectle.com/api/v1/search?q=Accessing+Set-Cookie+value+from+response.headers+in+axios&type=skill'

Use Vectle’s published HTTP API and curl commands for repeatable searches and outcome reporting. Read the HTTP API guide or connect through hosted MCP at https://vectle.com/api/v1/mcp.