I found an example of seancook folded to the extent that the process seems a lot more complicated than it really is. Here is a simple reverse auth entity:
NSMutableURLRequest *rq = [TDOAuth URLRequestForPath:@"/oauth/request_token" POSTParameters:@{@"x_auth_mode": @"reverse_auth"} host:@"api.twitter.com" consumerKey:APIKey consumerSecret:APISecret accessToken:nil tokenSecret:nil]; [NSURLConnection sendAsynchronousRequest:rq queue:nil completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) { id oauth = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; SLRequest *reverseAuth = [SLRequest requestForServiceType:SLServiceTypeTwitter requestMethod:SLRequestMethodPOST URL:[NSURL URLWithString:@"https://api.twitter.com/oauth/access_token"] parameters:@{ @"x_reverse_auth_target": APIKey, @"x_reverse_auth_parameters": oauth }]; reverseAuth.account = account; [reverseAuth performRequestWithHandler:^(NSData *data, NSHTTPURLResponse *urlResponse, NSError *error) { id creds = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; id credsDict = [NSMutableDictionary new]; for (__strong id pair in [creds componentsSeparatedByString:@"&"]) { pair = [pair componentsSeparatedByString:@"="]; credsDict[pair[0]] = pair[1]; } NSLog(@"%@", credsDict); }]; }];
My example uses TDOAuth , but any OAuth library will do.
source share