



(1 ratings)
| Number of watchers on Github | 1156 |
| Number of open issues | 23 |
| Average time to close an issue | 3 months |
| Main language | Objective-C |
| Average time to merge a PR | about 2 months |
| Open pull requests | 12+ |
| Closed pull requests | 42+ |
| Last commit | over 3 years ago |
| Repo Created | over 7 years ago |
| Repo Last Updated | over 1 year ago |
| Size | 9.47 MB |
| Organization / Author | afnetworking |
| Latest Release | 3.0.0 |
| Contributors | 19 |
| Page Updated | 2018-03-14 |
| Do you use AFOAuth2Manager? Leave a review! | |
| View open issues (23) | |
| View AFOAuth2Manager activity | |
| View on github | |
| Fresh, new opensource launches 🚀🚀🚀 | |
|
Trendy new open source projects in your inbox!
View examples
|
|
AFOAuth2Manager is an extension for AFNetworking that simplifies the process of authenticating against an OAuth 2 provider.
NSURL *baseURL = [NSURL URLWithString:@"http://example.com/"];
AFOAuth2Manager *OAuth2Manager =
[[AFOAuth2Manager alloc] initWithBaseURL:baseURL
clientID:kClientID
secret:kClientSecret];
[OAuth2Manager authenticateUsingOAuthWithURLString:@"/oauth/token"
username:@"username"
password:@"password"
scope:@"email"
success:^(AFOAuthCredential *credential) {
NSLog(@"Token: %@", credential.accessToken);
}
failure:^(NSError *error) {
NSLog(@"Error: %@", error);
}];
AFHTTPSessionManager *manager =
[[AFHTTPSessionManager alloc] initWithBaseURL:baseURL];
[manager.requestSerializer setAuthorizationHeaderFieldWithCredential:credential];
[manager GET:@"/path/to/protected/resource"
parameters:nil
progress:nil
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
NSLog(@"Success: %@", responseObject);
}
failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
NSLog(@"Failure: %@", error);
}];
[AFOAuthCredential storeCredential:credential
withIdentifier:serviceProviderIdentifier];
AFOAuthCredential *credential =
[AFOAuthCredential retrieveCredentialWithIdentifier:serviceProviderIdentifier];
Documentation for all releases of AFOAuth2Manager are available on CocoaDocs.
AFOAuth2Manager is available under the MIT license. See the LICENSE file for more info.
Released on Friday, April 15, 2016. All issues associated with this milestone can be found using this filter.
AFOAuth2Manager to inherit from AFHTTPSessionManager to support AFNetworking 3.0