pusher/libPusher

Pusher Authentication(Authorization) fails without any error.

Closed this issue · 1 comments

I have been using Xcode 6.x to build and my app connects and authorizes successfully. When I migrated to Xcode 7.2.1 the app is never able to authorize. I am already using a https url but just for the sake of it have disabled ATS. Using 'libPusher', '1.6.1' version.

In the Connection delegate method "didDisconnectWithError:" I am getting no error messages.

[pusher-(null)] Pusher Connection disconnected with error: (null)

In the class "PTPusher.m" the method - (void)pusherConnection:(PTPusherConnection *)connection didDisconnectWithCode:(NSInteger)errorCode reason:(NSString *)reason wasClean:(BOOL)wasClean the errocode here is 0 and hence it returns no error to the connection delegate.

[Update] Got this error after digging around, even after presence channel was successfully subscribed.
PTPusherErrorEvent code:-1 message:Invalid signature: Expected HMAC SHA256 hex digest of 197596.1756195:presence-nySHukq6sW:{"user_id":"nySHukq6sW","user_info":{"username":"xxxxx","email":"xxxx@gmail.com"}}, but got 397ec17d4c4e7a2ced1c2c65539a594b85606985f1245da560e80d1c3680581e

How can I go about debugging this?

This issue was caused by multiple simultaneous calls to client connect. The primary client connect was called on "Application did finish launching" and there was a fall back on Reachability Internet connected state which would call client disconnect and client connect. This was happening even with client isConnected being checked. When additional defensive code was added to prevent this, everything started working fine again.