Conforms to NSObject
Declared in AGAuthzModule.h

Overview

AGAuthzModule represents an OAuth2 module and provides an interface for managing OAuth2 dance. The default implementation uses REST as the authz transport. Similar to the Pipe, technical details of the underlying system are not exposed.

Login

Once you have a valid user you can use that information to issue a login against the server, to start accessing protected endpoints:

AGAuthorizer* authorizer = [AGAuthorizer authorizer];

_restAuthzModule = [authorizer authz:^(id<AGAuthzConfig> config) {
    config.name = @"restAuthMod";
    config.baseURL = [[NSURL alloc] initWithString:@"https://accounts.google.com"];
    config.authzEndpoint = @"/o/oauth2/auth";
    config.accessTokenEndpoint = @"/o/oauth2/token";
    config.clientId = @"XXXXXXX";
    config.clientSecret = @"XXXXXXX";
    config.redirectURL = @"org.aerogear.GoogleDrive:/oauth2Callback";
    config.scopes = @[@"https://www.googleapis.com/auth/drive"];
}];

[_restAuthzModule requestAccessSuccess:^(id object) {
   // object contain the access token needed to query exposed web service
   // You can use ipe as usual
} failure:^(NSError *error) {
    // an error occurred
}];

}

The requestAccess:success:failure: function deal with the OAuth dance. To manage callback to application, the AeroGear uses URL scheme. Schema should be carefully defined in you plist application.

Time out and Cancel pending operations

As with the case of Pipe, configured timeout interval (in the config object) and cancel operation in AGAuthenticationModule is supported too.