AFOAuth2Client@phoenixplatform 0.1.1.1

AFOAuth2Client@phoenixplatform 0.1.1.1

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

Maintained by Unclaimed.



  • By
  • Mattt Thompson and Steven Zhang

AFOAuth2Client

AFOAuth2Client is an extension for AFNetworking that greatly simplifies the process of authenticating against an OAuth 2 provider.

This fork is created by Github user @mlwelles which bumps AFNetworking version requirement to 2.0.

Example Usage

NSURL *url = [NSURL URLWithString:@"http://example.com/"];
AFOAuth2Client *oauthClient = [AFOAuth2Client clientWithBaseURL:url clientID:kClientID secret:kClientSecret];

[oauthClient authenticateUsingOAuthWithPath:@"/oauth/token"
                                   username:@"username"
                                   password:@"password"
                                      scope:@"email"
                                    success:^(AFOAuthCredential *credential) {
                                        NSLog(@"I have a token! %@", credential.accessToken);
                                        [AFOAuthCredential storeCredential:credential withIdentifier:oauthClient.serviceProviderIdentifier];
                                    }
                                    failure:^(NSError *error) {
                                        NSLog(@"Error: %@", error);
                                    }];

Contact

Mattt Thompson

License

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