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

Observable.ajax does not appear to recognize "withCredentials" mode for CORS #1711

Closed
wizardwerdna opened this issue May 16, 2016 · 3 comments

Comments

@wizardwerdna
Copy link

(<any> Observable).ajax({
  url: `${YQL_BASE}?q=${YQL_QUERY}&${YQL_FORMAT}`,
  crossDomain: true,
  withCredentials: false
})
.subscribe(
  x => console.log("ajax", x),
  err => console.log("ajax err", err)
);

Observable.ajax does not appear to recognize the withCredentials mode for CORS, either expressly or as the promised default.

This code, when run on Chrome, yields substantially the following:

XMLHttpRequest cannot load . A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin' header when the credentials flag is true. Origin 'http://localhost:8080' is therefore not allowed access. The credentials mode of an XMLHttpRequest is controlled by the withCredentials attribute.

and the browser console message:

ajax err AjaxError {message: "ajax error 0", xhr: XMLHttpRequest, request: Object, status: 0}

The works when clicked in the browser error message. Similar code, using jQuery or fetch and Observable.fromPromise, works fine.

@kwonoj
Copy link
Member

kwonoj commented Jun 8, 2016

Related with #1732, not exact dupe but expect to be resolved at once.

kwonoj added a commit to kwonoj/rxjs that referenced this issue Jun 9, 2016
- AjaxRequest now support setting withCredentials flag

closes ReactiveX#1732, ReactiveX#1711
kwonoj added a commit to kwonoj/rxjs that referenced this issue Jun 9, 2016
- AjaxRequest now support setting withCredentials flag

closes ReactiveX#1732, ReactiveX#1711
kwonoj added a commit to kwonoj/rxjs that referenced this issue Jun 13, 2016
- AjaxRequest now support setting withCredentials flag

closes ReactiveX#1732, ReactiveX#1711
@kwonoj
Copy link
Member

kwonoj commented Jun 21, 2016

I expect #1758 covers this by supporting withCredentials in options to create XHR, closing issue. Please feel freely reopen if issue persists with latest master.

@kwonoj kwonoj closed this as completed Jun 21, 2016
@lock
Copy link

lock bot commented Jun 7, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants