Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to set the option 'credentials' #55

Closed
Cervenka opened this issue Jan 31, 2023 · 3 comments · Fixed by #57
Closed

Ability to set the option 'credentials' #55

Cervenka opened this issue Jan 31, 2023 · 3 comments · Fixed by #57

Comments

@Cervenka
Copy link

It may be useful to be able to set the option credentials to include.

At the moment it is hardcoded to same-origin.
https://github.com/rails/request.js/blob/main/src/fetch_request.js#L59

https://developer.mozilla.org/en-US/docs/Web/API/fetch#parameters

Thank you

@marcelolx
Copy link
Collaborator

Hey @Cervenka, do you have a use case in which you need to set it to include? I agree that it can be useful, but would like to know the use case before we move forward

@Cervenka
Copy link
Author

In my case I'm sending requests to a different subdomain (app.domain.com --> legacy-api.domain.com) - so cross origin.
legacy-api.domain.com's responds with the correct CORS headers.

I need the request to include the cookies that are shared across *.domain.com.
With the option set to same-origin the cookies are not included - similar to XHR calls with withCredentials set to false.

Thanks!

@marcelolx
Copy link
Collaborator

gotcha, thanks, I may have some time tomorrow to work on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants