[GH-ISSUE #1383] Support for Cookies #453

Closed
opened 2026-03-16 15:23:34 +03:00 by kerem · 20 comments
Owner

Originally created by @mulka on GitHub (Dec 13, 2020).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/1383

Is your feature request related to a problem? Please describe.
I don't see a way to add cookies to requests. I'm using a session cookie to authenticate to an API, but I don't see a way to add a cookie to a request in Hoppscotch

Describe the solution you'd like
I'd like to have a place to put cookies so they can be sent with every request to an API in Hoppscotch

Describe alternatives you've considered
Use a different tool I guess.

Additional context

Originally created by @mulka on GitHub (Dec 13, 2020). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/1383 **Is your feature request related to a problem? Please describe.** I don't see a way to add cookies to requests. I'm using a session cookie to authenticate to an API, but I don't see a way to add a cookie to a request in Hoppscotch **Describe the solution you'd like** I'd like to have a place to put cookies so they can be sent with every request to an API in Hoppscotch **Describe alternatives you've considered** Use a different tool I guess. **Additional context**
kerem 2026-03-16 15:23:34 +03:00
Author
Owner

@AndrewBastin commented on GitHub (Dec 13, 2020):

Umm, we have thought about this.

But the problem we are facing is that since Hoppscotch runs on the browser, we are faced with limitations which are set on the platform. Browsers currently don't provide an API that lets us set cookies for requests for security reasons (we can set for the cookies in a document space ofc, but not for XHRs).

<!-- gh-comment-id:744076322 --> @AndrewBastin commented on GitHub (Dec 13, 2020): Umm, we have thought about this. But the problem we are facing is that since Hoppscotch runs on the browser, we are faced with limitations which are set on the platform. Browsers currently don't provide an API that lets us set cookies for requests for security reasons (we can set for the cookies in a document space ofc, but not for XHRs).
Author
Owner

@mulka commented on GitHub (Dec 13, 2020):

Gotcha. I wonder how Postman does cookies

<!-- gh-comment-id:744081679 --> @mulka commented on GitHub (Dec 13, 2020): Gotcha. I wonder how Postman does cookies
Author
Owner

@AndrewBastin commented on GitHub (Dec 14, 2020):

Postman can take advantage of the fact that it is running natively (it is an Electron app) which allows it to use the native APIs which do provide cookie support.

<!-- gh-comment-id:744709339 --> @AndrewBastin commented on GitHub (Dec 14, 2020): Postman can take advantage of the fact that it is running natively (it is an Electron app) which allows it to use the native APIs which do provide cookie support.
Author
Owner

@Leodau commented on GitHub (Feb 5, 2021):

You should close this issue, browsers would hopefully never be able to check HttpOnly cookies. 🙏

<!-- gh-comment-id:773938318 --> @Leodau commented on GitHub (Feb 5, 2021): You should close this issue, browsers would hopefully never be able to check _HttpOnly_ cookies. :pray:
Author
Owner

@fr3fou commented on GitHub (Mar 9, 2021):

You should close this issue, browsers would hopefully never be able to check HttpOnly cookies. 🙏

But how would one test an API that uses cookies?

<!-- gh-comment-id:794178046 --> @fr3fou commented on GitHub (Mar 9, 2021): > You should close this issue, browsers would hopefully never be able to check _HttpOnly_ cookies. 🙏 But how would one test an API that uses cookies?
Author
Owner

@hedior03 commented on GitHub (Jul 16, 2021):

Is this the reason why my API responses:

{
  "detail": "CSRF Failed: CSRF token missing or incorrect."
}
<!-- gh-comment-id:881281388 --> @hedior03 commented on GitHub (Jul 16, 2021): Is this the reason why my API responses: ``` { "detail": "CSRF Failed: CSRF token missing or incorrect." } ```
Author
Owner

@b5l commented on GitHub (Sep 7, 2021):

Bump, since there is a Hoppscotch browser extension, shouldn't it be possible to let it solve our cookie issue?

<!-- gh-comment-id:914142329 --> @b5l commented on GitHub (Sep 7, 2021): Bump, since there is a Hoppscotch browser extension, shouldn't it be possible to let it solve our cookie issue?
Author
Owner

@nelsontky commented on GitHub (Oct 4, 2021):

This is interesting! May I try implementing this? I will open a PR in the extension repository if this functionality is possible.

<!-- gh-comment-id:933638874 --> @nelsontky commented on GitHub (Oct 4, 2021): This is interesting! May I try implementing this? I will open a PR in the extension repository if this functionality is possible.
Author
Owner

@liyasthomas commented on GitHub (Oct 4, 2021):

Hi @nelsontky, you're free to pick up this one. And yes - this is a tricky one to implement.

<!-- gh-comment-id:933679670 --> @liyasthomas commented on GitHub (Oct 4, 2021): Hi @nelsontky, you're free to pick up this one. And yes - this is a tricky one to implement.
Author
Owner

@nelsontky commented on GitHub (Oct 4, 2021):

Ok @liyasthomas I have opened a PR!

<!-- gh-comment-id:933755878 --> @nelsontky commented on GitHub (Oct 4, 2021): Ok @liyasthomas I have opened a PR!
Author
Owner

@vaaski commented on GitHub (May 3, 2022):

what happened to this?

<!-- gh-comment-id:1116077367 --> @vaaski commented on GitHub (May 3, 2022): what happened to this?
Author
Owner

@AndrewBastin commented on GitHub (May 3, 2022):

@vaaski With the merging of hoppscotch/hoppscotch-extension#88 we have merged the code for supporting cookies into the extension and it does sorta work as indicated and shown in the PR. We are actually working on having proper documentation and proper UX for Cookies which should be live in a couple of weeks.

<!-- gh-comment-id:1116081700 --> @AndrewBastin commented on GitHub (May 3, 2022): @vaaski With the merging of hoppscotch/hoppscotch-extension#88 we have merged the code for supporting cookies into the extension and it does sorta work as indicated and shown in the PR. We are actually working on having proper documentation and proper UX for Cookies which should be live in a couple of weeks.
Author
Owner

@vaaski commented on GitHub (May 3, 2022):

thanks for the swift reply, i just noticed i already commented on https://github.com/hoppscotch/hoppscotch-extension/pull/88 so apparently i was aware of it in the past and forgot

<!-- gh-comment-id:1116083867 --> @vaaski commented on GitHub (May 3, 2022): thanks for the swift reply, i just noticed i already commented on https://github.com/hoppscotch/hoppscotch-extension/pull/88 so apparently i was aware of it in the past and forgot
Author
Owner

@LMCom commented on GitHub (Jan 15, 2024):

Umm, we have thought about this.

But the problem we are facing is that since Hoppscotch runs on the browser, we are faced with limitations which are set on the platform. Browsers currently don't provide an API that lets us set cookies for requests for security reasons (we can set for the cookies in a document space ofc, but not for XHRs).

I am currently using the standalone application in macOS. It does not seem to save the session cookie after login. This prevents me from being able to test most of my application.

<!-- gh-comment-id:1891968052 --> @LMCom commented on GitHub (Jan 15, 2024): > Umm, we have thought about this. > > But the problem we are facing is that since Hoppscotch runs on the browser, we are faced with limitations which are set on the platform. Browsers currently don't provide an API that lets us set cookies for requests for security reasons (we can set for the cookies in a document space ofc, but not for XHRs). I am currently using the standalone application in macOS. It does not seem to save the session cookie after login. This prevents me from being able to test most of my application.
Author
Owner

@rishabmahesh commented on GitHub (Mar 4, 2024):

@LMCom Did you find a workaround? I'm also facing the same issue

<!-- gh-comment-id:1976841172 --> @rishabmahesh commented on GitHub (Mar 4, 2024): @LMCom Did you find a workaround? I'm also facing the same issue
Author
Owner

@nelsontky commented on GitHub (Mar 4, 2024):

@LMCom Did you find a workaround? I'm also facing the same issue

Was an old PR i wrote but if i remember correctly cookies will only work on the web version with the extension installed

<!-- gh-comment-id:1977210172 --> @nelsontky commented on GitHub (Mar 4, 2024): > @LMCom Did you find a workaround? I'm also facing the same issue Was an old PR i wrote but if i remember correctly cookies will only work on the web version with the extension installed
Author
Owner

@liyasthomas commented on GitHub (Mar 4, 2024):

Hoppscotch Desktop App supports cookies: https://docs.hoppscotch.io/documentation/features/cookies

<!-- gh-comment-id:1977286180 --> @liyasthomas commented on GitHub (Mar 4, 2024): Hoppscotch Desktop App supports cookies: https://docs.hoppscotch.io/documentation/features/cookies
Author
Owner

@LMCom commented on GitHub (Mar 5, 2024):

@LMCom Did you find a workaround? I'm also facing the same issue

I didn't find one.

Hoppscotch Desktop App supports cookies: https://docs.hoppscotch.io/documentation/features/cookies

Sounds good! But my understanding is that the cookies have to be created manually.

My use-case is a login. After posting the correct credentials, the application responds with a cookie that should keep me logged in. I whitelisted the domain via the cookie settings but no cookie is being created after login. Subsequent GET-requests just redirect me to the login page.
I tried copying the cookie string and setting it manually for the domain but it doesn't seem to have any effect.

grafik

<!-- gh-comment-id:1978178098 --> @LMCom commented on GitHub (Mar 5, 2024): > > @LMCom Did you find a workaround? I'm also facing the same issue I didn't find one. > Hoppscotch Desktop App supports cookies: https://docs.hoppscotch.io/documentation/features/cookies Sounds good! But my understanding is that the cookies have to be created manually. My use-case is a login. After posting the correct credentials, the application responds with a cookie that should keep me logged in. I whitelisted the domain via the cookie settings but no cookie is being created after login. Subsequent GET-requests just redirect me to the login page. I tried copying the cookie string and setting it manually for the domain but it doesn't seem to have any effect. ![grafik](https://github.com/hoppscotch/hoppscotch/assets/14162803/bc76af7f-69e6-4aa8-acb4-39d071a7a39f)
Author
Owner

@rishabmahesh commented on GitHub (Mar 5, 2024):

Hoppscotch Desktop App supports cookies: https://docs.hoppscotch.io/documentation/features/cookies

Sounds good! But my understanding is that the cookies have to be created manually.

My use-case is a login. After posting the correct credentials, the application responds with a cookie that should keep me logged in. I whitelisted the domain via the cookie settings but no cookie is being created after login. Subsequent GET-requests just redirect me to the login page. I tried copying the cookie string and setting it manually for the domain but it doesn't seem to have any effect.

grafik

Yup, I have the exact same use case. The cookie doesn't get set automatically

<!-- gh-comment-id:1978938081 --> @rishabmahesh commented on GitHub (Mar 5, 2024): > > Hoppscotch Desktop App supports cookies: https://docs.hoppscotch.io/documentation/features/cookies > > Sounds good! But my understanding is that the cookies have to be created manually. > > My use-case is a login. After posting the correct credentials, the application responds with a cookie that should keep me logged in. I whitelisted the domain via the cookie settings but no cookie is being created after login. Subsequent GET-requests just redirect me to the login page. I tried copying the cookie string and setting it manually for the domain but it doesn't seem to have any effect. > > ![grafik](https://private-user-images.githubusercontent.com/14162803/310029573-bc76af7f-69e6-4aa8-acb4-39d071a7a39f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDk2NTAxNzEsIm5iZiI6MTcwOTY0OTg3MSwicGF0aCI6Ii8xNDE2MjgwMy8zMTAwMjk1NzMtYmM3NmFmN2YtNjllNi00YWE4LWFjYjQtMzlkMDcxYTdhMzlmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAzMDUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMzA1VDE0NDQzMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTlkZWIyOTY4MjJmM2I1MTc0NjE3NzRjMjQxNzY4MWM1ZTk0ZmRkNmZiNDJkZTY1ZjBiOWY1MGQ3YTk4ZmU3MGYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.4KVON9NHZmbJxmTYm7XiTvkQJeB-BBG2_J96zCJpPmI) Yup, I have the exact same use case. The cookie doesn't get set automatically
Author
Owner

@MexHigh commented on GitHub (May 26, 2024):

Was an old PR i wrote but if i remember correctly cookies will only work on the web version with the extension installed

I don't see any option to set cookies in the web version even with the extension in use. The documentation also states that cookies are only supported on Desktop.

@liyasthomas Why is that? Since using the extension bypasses the XHR limitations, this should be possible, right?

<!-- gh-comment-id:2132310018 --> @MexHigh commented on GitHub (May 26, 2024): > Was an old PR i wrote but if i remember correctly cookies will only work on the web version with the extension installed I don't see any option to set cookies in the web version even with the extension in use. The documentation also states that cookies are only supported on Desktop. @liyasthomas Why is that? Since using the extension bypasses the XHR limitations, this should be possible, right?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#453
No description provided.