Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
AFNetworking Extension for OAuth 2 Authentication
branch: master

This branch is 47 commits behind AFNetworking:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
AFOAuth2Client.xcworkspace
AFOAuth2Client
AFOAuth2Client.podspec
LICENSE
README.md

README.md

AFOAuth2Client

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

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);
                                    }];

Documentation

Documentation for all releases of AFOAuth1Client, including the latest, are available on CocoaDocs.

Contact

Mattt Thompson

License

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

Something went wrong with that request. Please try again.