Skip to content

AFNetworking Extension for OAuth 2 Authentication

License

Notifications You must be signed in to change notification settings

japr/AFOAuth2Client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
Conrad Kramer
Jan 28, 2013
fa7f77d · Jan 28, 2013

History

22 Commits
Jan 28, 2013
Dec 28, 2012
Dec 6, 2011
Dec 6, 2012

Repository files navigation

AFOAuth2Client

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

This is still in early stages of development, so proceed with caution when using this in a production application. Any bug reports, feature requests, or general feedback at this point would be greatly appreciated.

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"
                                    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.

About

AFNetworking Extension for OAuth 2 Authentication

Resources

License

Stars

Watchers

Forks

Packages

No packages published