AFLinkedInOAuth1Client 0.0.3

AFLinkedInOAuth1Client 0.0.3

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Mar 2015

Maintained by Unclaimed.



  • By
  • PJ Gray

An AFOAuth1Client subclass for easily authenticating with LinkedIn.

Instructions

Register your application to launch from a custom URL scheme, and use that with the path /success as your callback URL.

Here's how it all looks together:

AFLinkedInOAuth1Client *linkedinClient = [[AFLinkedInOAuth1Client alloc] initWithBaseURL:[NSURL URLWithString:@"https://api.linkedin.com/"]
                                                                     key:@"KEY"
                                                                  secret:@"SECRET"];

[linkedinClient authorizeUsingOAuthWithRequestTokenPath:@"uas/oauth/requestToken"
                                  userAuthorizationPath:@"uas/oauth/authorize"
                                            callbackURL:[NSURL URLWithString:@"x-yourscheme://success"]
                                        accessTokenPath:@"uas/oauth/accessToken"
                                           accessMethod:@"POST"
                                                success:^(AFOAuth1Token *accessToken) {
                                                    NSLog(@"Success: %@", accessToken);
                                                } failure:^(NSError *error) {
                                                    NSLog(@"Error: %@", error);
                                                }];

Details for LinkedIn

Two problems occur from the base AFOAuth1Client implementation, onlined on this page.

  • Content-Type needs to be text/xml. Don't think thats in the OAuth spec...
  • "Properly handling oauth_token_secret"

Contact

PJ Gray

License

AFLinkedInOAuth1Client is available under the MIT license. See the LICENSE file for more info.