Are you happy with your logging solution? Would you help us out by taking a 30-second survey? Click here


AFNetworking Extension for OAuth 2 Authentication

Star full 4f7b624809470f25b6493d5a7b30d9b9cb905931146e785d67c86ef0c205a402Star full 4f7b624809470f25b6493d5a7b30d9b9cb905931146e785d67c86ef0c205a402Star full 4f7b624809470f25b6493d5a7b30d9b9cb905931146e785d67c86ef0c205a402Star full 4f7b624809470f25b6493d5a7b30d9b9cb905931146e785d67c86ef0c205a402Star full 4f7b624809470f25b6493d5a7b30d9b9cb905931146e785d67c86ef0c205a402 (1 ratings)
Rated 5.0 out of 5
Subscribe to updates I use AFOAuth2Manager

Statistics on AFOAuth2Manager

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 / Authorafnetworking
Latest Release3.0.0
Page Updated
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

Subscribe to our mailing list

Evaluating AFOAuth2Manager for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)


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

Example Usage


NSURL *baseURL = [NSURL URLWithString:@""];
AFOAuth2Manager *OAuth2Manager =
            [[AFOAuth2Manager alloc] initWithBaseURL:baseURL

[OAuth2Manager authenticateUsingOAuthWithURLString:@"/oauth/token"
                                           success:^(AFOAuthCredential *credential) {
                                               NSLog(@"Token: %@", credential.accessToken);
                                           failure:^(NSError *error) {
                                               NSLog(@"Error: %@", error);

Authorizing Requests

AFHTTPSessionManager *manager =
    [[AFHTTPSessionManager alloc] initWithBaseURL:baseURL];

[manager.requestSerializer setAuthorizationHeaderFieldWithCredential:credential];

[manager GET:@"/path/to/protected/resource"
     success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
         NSLog(@"Success: %@", responseObject);
     failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
         NSLog(@"Failure: %@", error);

Storing Credentials

[AFOAuthCredential storeCredential:credential

Retrieving Credentials

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.

AFOAuth2Manager open issues Ask a question     (View All Issues)
  • almost 3 years OAuth url is https url, and use self signed certificate
  • about 3 years Both (failure and success) callbacks runs at the same request
  • over 3 years Is this Support to IOS for generate AccessToken From Backend server?
  • over 3 years AFHTTPRequestSerializer-requestWithMethod:URLString: should take NSURL object
  • over 3 years Request failed: unauthorized (401)
  • over 3 years setAuthorizationHeaderFieldWithCredential: produces wrong header
  • over 3 years AFJSONRequestOperation with POST Method give "signature_invalid"
  • over 3 years Tag for version 2.2.1
  • almost 4 years Minor import paths issue
  • about 4 years Memory leak in AFOAuth2Manager.m
  • about 4 years oAutoh to google
  • over 4 years It's not possible to retrieve secondary data from the authentication request
  • over 5 years Does not support authorization requests
AFOAuth2Manager open pull requests (View All Pulls)
  • Add support for Keychain sharing
  • Using #import "AFNetworking.h" instead of @import
  • Added the data task and response object as a callback argument for the
  • Return AFHTTPRequestOperation in failure blocks.
  • 3.0.0
  • Removed the address check, already a pointer.
  • add custom keychain service name && only logs on debuging
  • NSURLSession based Manager + AFNetworking 3.0 support
  • @importing AFNetworking
  • Both (failure and success) callbacks runs at the same request
  • Fix useHTTPBasicAuthentication usage
  • Use module import if available
AFOAuth2Manager questions on Stackoverflow (View All Questions)
  • How to automatically refresh expired token with AFOAuth2Manager?
  • Getting authenticate with AFOAuth2Manager
  • AFOAuth2Manager Swift cannot invoke with an argument list of type
  • trouble using AFOAuth2manager to generate HTTPSOauthToken
  • Use AFOAuth2Manager to log user in with LinkedIn on iOS objective c
  • How do I use AFOAuth2Manager to get application credentials for the Twitter REST API
AFOAuth2Manager list of languages used
AFOAuth2Manager latest release notes
3.0.0 3.0.0

Released on Friday, April 15, 2016. All issues associated with this milestone can be found using this filter.


  • Added Travis Support for CI
    • Implemented by kcharwood in #124.
  • Added Carthage support
    • Implemented by kcharwood in #123.
  • Added tvOS support
    • Implemented by kcharwood in #120.
  • Added watchOS support
    • Implemented by kcharwood in #119.


  • Changed AFOAuth2Manager to inherit from AFHTTPSessionManager to support AFNetworking 3.0
    • Implemented by kcharwood in #122.


  • Removed support for AFNetworking 2.x
    • Implemented by kcharwood in #121.
Other projects in Objective-C