Skip to content
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

Private channel authorization response problem #171

Merged
merged 2 commits into from
Mar 3, 2015

Conversation

lukeredpath
Copy link
Contributor

Im attempting to use this library with an application backed by Parse.com, and am running into an issue with the authorization flow.

Parse wraps all of its cloud code responses in a "result" key, so the auth response from the server looks like {"result": {"auth": }}.

This seems to be keeping authorization attempts from working. Any way to specify how the server response should be parsed?

PS: I'm new to pusher, so there's a distinct possibility that in approaching this the wrong way.

Thanks!

@lukeredpath
Copy link
Contributor

Hmm, unfortunately the fundamental issue here is that Parse isn't returning the correct response for a Pusher authentication payload.

My work on custom authentication methods will probably solve this problem but its not a small change. In the meantime, I have an idea for a small extension to the Pusher delegate protocol that might fix this. I'll update this issue once I've had a chance to look at it.

@lukeredpath
Copy link
Contributor

@jalehman if you're able to use the above branch (this should be easy enough if you're using CocoaPods), you'll see I've added a new delegate method that can be used to modify the auth response and return something in the correct format.

In your case, you would implement it like this:

 - (NSDictionary *)pusher:(PTPusher *)pusher authorizationPayloadFromResponseData:(NSDictionary *)responseData
{
    return responseData[@"result"];
}

Please let me know how you get on.

@jalehman
Copy link
Author

@lukeredpath That did the trick! Thanks a ton for the quick response and fix (despite the fault being with Parse).

@jalehman jalehman closed this Feb 25, 2015
@lukeredpath
Copy link
Contributor

Thanks. I'm going to leave this open until I've merged it.

@lukeredpath lukeredpath reopened this Feb 25, 2015
lukeredpath added a commit that referenced this pull request Mar 3, 2015
…sponses

Private channel authorization response problem
@lukeredpath lukeredpath merged commit bb793d2 into master Mar 3, 2015
@lukeredpath lukeredpath deleted the support-non-standard-auth-responses branch March 3, 2015 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants