1

I am trying to implement Reverse Auth in an iOS PhoneGap / Cordova application.

I have Step 1 working correctly - my server performs a Token Request and returns the OAuth-Header-Like response to the mobile application.

But Step 2 isn't working. The response from Step 1 is sent to "/oauth/access_token" but I receive the response: Reverse auth credentials are invalid

Here is what my Step 1 response looks like:

OAuth oauth_token="xxx", oauth_timestamp="1361189727", oauth_nonce="QoUtVy4wchGbrSg7biruOIqsTU7G5gZHix9K7a5yU0", oauth_signature_method="HMAC-SHA1", oauth_signature="qcCuBxaYFJRVi0C1rpuqygSg6Bs%3D", oauth_consumer_key="xxx", oauth_version="1.0"

Here is what my Step 2 code is:

NSDictionary *step2Params = [[NSMutableDictionary alloc] init];
[step2Params setValue:TW_CONSUMER_KEY forKey:@"x_reverse_auth_target"];
[step2Params setValue:step1ResponseString:@"x_reverse_auth_parameters"];
NSURL *authTokenURL = [NSURL URLWithString:TW_OAUTH_URL_AUTH_TOKEN];
id<GenericTwitterRequest> step2Request =
[self requestWithUrl:authTokenURL
          parameters:step2Params
       requestMethod:SLRequestMethodPOST];
[step2Request setAccount:selectedTwitterAccount];
[step2Request performRequestWithHandler:^(NSData *responseData, NSURLResponse *urlResponse, NSError *step2error)

I am using this plugin to handle the Reverse Auth calls: https://github.com/PatrickHeneise/SocialAuthenticationPlugin/blob/master/iOS/SocialAuthenticationPlugin.m

Any help on what is going wrong?

The Step 1 response is in the form described in the docs ("oauth header like") and Step 2 just passes that exact string to Twitter along with my consumer key. What am I missing?

4

0 回答 0