GithubHelp home page GithubHelp logo

Comments (6)

fiatjaf avatar fiatjaf commented on August 22, 2024 21

Today you would have to do

Pusher.Runtime.createXHR = function () {
  var xhr = new XMLHttpRequest()
  xhr.withCredentials = true
  return xhr
}

from pusher-js.

tadas-s avatar tadas-s commented on August 22, 2024 19

Hello,

Are there any plans to implement this? 4 years later, IE9 is largely irrelevant browser.

Cheers guys

from pusher-js.

seven1m avatar seven1m commented on August 22, 2024 3

Had the same need (enable withCredentials on the xhr). This was my solution:

Pusher.XHR = ->
  xhr = new XMLHttpRequest()
  xhr.withCredentials = true
  xhr

from pusher-js.

pl avatar pl commented on August 22, 2024

Hi Ryan,

You're right about pusher-js not setting the withCredentials flag, but it's not required for CORS. It only tells whether to send cookies and some headers with the request; browsers will send CORS headers regardless of its value.

https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest

However, the AJAX authorizer will not work in some environments - for example Opera < 12 or IE < 10. For cross-origin auth pusher-js implements the JSONP authorizer, which works in every browser supported by pusher-js.

http://pusher.com/docs/authenticating_users#jsonp_authentication

from pusher-js.

ryandotsmith avatar ryandotsmith commented on August 22, 2024

Thanks for pointing me at the right place. I have my setup working correctly now. I still think it would be nice if the library would send credentials on the xhr request.

from pusher-js.

chris-martin avatar chris-martin commented on August 22, 2024

I just spent a while tracking this down. The documentation perhaps could make it a little more clear that jsonp is the only supported way to do cross-origin auth.

from pusher-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.