question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

feat(http): add support for withCredentials

See original GitHub issue

Hey, I’m trying to figure out how to send cookies throught CORS but since I can’t access XMLHttpRequest objects directly I’m not able to set withCredentials option. I remember using it with $http in Angular 1.4. Maybe I could do this by writting custom XHRBackend? Or is there any easier way?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:1
  • Comments:33 (8 by maintainers)

github_iconTop GitHub Comments

12reactions
icerevalcommented, Jan 2, 2016

@brianaprince, here is a workaround I’ve been using for now…

@Injectable()
export class Auth {
  isAuthenticated = false;
  user: User;

  constructor(@Inject(Http) private http: Http) {
    // TODO: Use official Angular2 CORS support when merged (https://github.com/angular/angular/issues/4231).
    let _build = (<any> http)._backend._browserXHR.build;
    (<any> http)._backend._browserXHR.build = () => {
      let _xhr =  _build();
      _xhr.withCredentials = true;
      return _xhr;
    };
  }
...
4reactions
scottiecommented, Aug 1, 2018

just usless really… useless… well that was a fun Angular experiment back to reactJS…

Read more comments on GitHub >

github_iconTop Results From Across the Web

XMLHttpRequest.withCredentials - Web APIs | MDN
The XMLHttpRequest.withCredentials property is a boolean value that indicates whether or not cross-site Access-Control requests should be ...
Read more >
angular2, http with credentials. Can't add cookies
Okay, here's my call to get user settings after login. When you login, webapi2 returns a token which is good to authorize that...
Read more >
Understanding the Basics to CORS and Fetch Credentials
Now in order to keep your users safe on your site, you can add credentials to your fetch requests based upon whether or...
Read more >
eRA Commons User Guide
Web: https://www.era.nih.gov/need-help (Preferred method of contact) ... 4.1.1 Accessing Commons with Your Organization Credentials.
Read more >
Changelog - Cyberduck
There are also snapshot and beta builds available featuring the latest ... Bugfix Add support reading IdentityAgent from OpenSSH configuration (SFTP) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found