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

Browser cookies not sent by default, no easy way to change #203

Closed
DanielVF opened this issue Mar 19, 2015 · 5 comments
Closed

Browser cookies not sent by default, no easy way to change #203

DanielVF opened this issue Mar 19, 2015 · 5 comments

Comments

@DanielVF
Copy link

When using jQuery's ajax methods, the browser's cookies are sent along with each same-origin request. If your user is currently logged in, then their requests are logged in too.

The fetch spec however requires that no cookies be sent unless the credentials option is explicitly set to 'same-origin' or the stronger 'include'. (see here: https://github.com/github/fetch/pull/69/files?diff=split )

There's currently no way to set the global fetch options for a new HttpStateSource, other than on each request you make.

I wonder if we should make HttpStateSource default to using credentials 'same-origin', and allow changing the default request options from HttpStateSource's mixinOptions.

@DanielVF DanielVF changed the title Browser cookies not send by default, no way to change Browser cookies not send by default, no easy way to change Mar 19, 2015
@DanielVF DanielVF changed the title Browser cookies not send by default, no easy way to change Browser cookies not sent by default, no easy way to change Mar 19, 2015
@jhollingworth
Copy link
Contributor

We've introduced the concept of "hooks" in v0.9 which allows you to modify requests before they are sent and responses after received. Do you think they could be used to fix this case?

@DanielVF
Copy link
Author

Yes, hooks look like they would allow me to globally change the behavior for my application.

Still might be nice to change the default marty behavior to send browser cookies on requests, though.

@jhollingworth
Copy link
Contributor

I'd like to avoid changing the existing behaviour if possible. If we're quietly modifying the expected behaviour of fetch this could confuse some people. If this becomes a recurring request then I will reconsider

Thanks!

@jhollingworth
Copy link
Contributor

I'm going to back track on my previous comment. #209 adds an http hook which sets credentials to 'same-origin'. This will be introduced in Marty v0.9

@DanielVF
Copy link
Author

Great! Thanks!

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

No branches or pull requests

2 participants