Comments (6)
Just to confirm, I've tried the following code in 1.8 and 1.9
require 'pusher'
Pusher.app_id = "test"
Pusher.secret = "7ad3773142a6692b25b8"
Pusher.key = "278d425bdf160c739803"
channel = Pusher["presence-foobar"]
json_user_data = {:user_id=>10, :user_info=>{:name=>"Mr. Pusher"}}
channel.authenticate("somerandomstring", json_user_data)
1.9.2 # => => {:auth=>"278d425bdf160c739803:4bb5bf1223aa38355503700a473f9c6ef9a373a7a83cea3ea2780a5992487280", :channel_data=>"{\"user_id\":10,\"user_info\":{\"name\":\"Mr. Pusher\"}}"}
1.8.7 # => {:auth=>"278d425bdf160c739803:08d9554eb2c1d58344cf56c100aebfa820d8f62c366f178eab8be1572b5f000b", :channel_data=>"{"user_info":{"name":"Mr. Pusher"},"user_id":10}"}
from pusher-http-ruby.
Woops - hit the wrong button
from pusher-http-ruby.
So, a Pusher upgrade must have happened recently and now the user info has to look like a Ruby 1.9 hash. SO when I try to auth I get:
Pusher : Event recd (event,data) : pusher:error : {"message":"Invalid signature: Expected HMAC SHA256 hex digest of 1251.29676:presence-3V71Jg:{"user_id"=>1311349106810, "user_info"=>{"id"=>1311349106810, "nick"=>"Guest"}}, but got 340be3a2a26307d91c9f6943983facf35e47dfd4e9e5f5d4e19b79d7f87e4139"}
This means in order to get my node js app working I had to replicate how a Ruby hash as a string looks like:
string_to_sign = req.body.socket_id + ":" + req.body.channel_name + ":{\"user_id\"=>\"" + req.session.user_id + "\", \"user_info\"=> {\"id\"=>\"" + req.user.id + "\", \"nick\"=>\"" + req.user.encodedNick() + "\"}}";
This isn't great - why not use a universal format like JSON?
from pusher-http-ruby.
We upgraded last week and included in that upgrade was a fix so that the error messages returns JSON and not a Ruby hash.
from pusher-http-ruby.
@thechrisoshow did you get any solution?
from pusher-http-ruby.
@webreinvent I have no idea sorry - that was 6 years ago!
from pusher-http-ruby.
Related Issues (20)
- Handling payload bigger than 10KB HOT 1
- How do you disconnect from the server side? HOT 1
- Pusher event namespaces? HOT 4
- Improve Pusher::Error for server side errors HOT 2
- Outdated changelog HOT 3
- Pusher : Error : {"type":"WebSocketError","error":{"type":"PusherError","data":{"code":1006,"message":"Connection interrupted (200)"}}} HOT 2
- Add Support for Encrypted Channels HOT 1
- Cluster should only override default if non-nil HOT 3
- Pusher.cluster delegates to Pusher::Client#cluster which is not defined HOT 5
- Libsodium dependency HOT 1
- changelog is not clear about breaking changes from v1.xx -> v2.xx HOT 2
- Can't set encryption_master_key_base64 using the global configuration style. HOT 3
- DEPRECATION WARNING `request#content_type` in Rails v7.0.1 HOT 5
- Pusher::Webhook#event for presence channel missing `user_info` HOT 1
- Pusher 2.0.3 + Pusher-Fake 3.0.1 + Webmock breaks HOT 2
- Replace httpclient with a more recent updated http client HOT 3
- Reporting a vulnerability HOT 1
- Pusher.use_tls = false vs Pusher.encrypted = false HOT 2
- Missing method to implement user authentication flow HOT 2
- Rails 7.1 will return Content-Type header without modification. If you want just the MIME type, please use `#media_type` instead.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pusher-http-ruby.