-
Notifications
You must be signed in to change notification settings - Fork 371
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
Way to pass CSRF token on authenticate? #3
Comments
I have this same issue. nickelser: Can you be more specific as to how you got around this? |
make sure you are including the csrf_meta_tags helper in your view, run the Pusher.csrf_token = $... code in some global init block, and then run setrequestheader in the ajaxsetup call. in coffeescript, I have a function like this: init_csrf = ->
window._settings.token = $('meta[name="csrf-token"]').attr 'content'
$.ajaxSetup
beforeSend: (xhr) ->
xhr.setRequestHeader "X-CSRF-Token", _settings.token |
Fix issue #9 (Bind to the online & offline event with addEventListener)
This isn't actually yet done, I'm working on a patch this week which should be released in the next couple of weeks. |
I'm having this problem as well, and it's been a while - Any progress on this? |
It's possible to pass additional parameters to be passed along with You can read the documentation here: |
Right now I have to use a slightly modified version of pusher.js instead of the hosted one, as right now pusher does not set "X-CSRF-Token" which is required by my rails app. I'm not entirely sure what the best way to do this on a global level would be, but I added a line like this to make it work:
xhr.setRequestHeader("X-CSRF-Token", Pusher.csrf_token)
(and set Pusher.csrf_token = $('meta[name="csrf-token"]').attr('content') before calling pusher init).
The text was updated successfully, but these errors were encountered: