AMZNAuthorizationManager Class Reference

Inherits from NSObject
Declared in AMZNAuthorizationManager.h

Overview

AMZNAuthorizationManager defines methods used to get authorization from a user and clean authorization state.

  sandboxMode

This property is used to decide whether to enable sandbox mode

@property (nonatomic, getter=isSandboxMode) BOOL sandboxMode

Availability

3.0

Discussion

This property is used to decide whether to enable sandbox mode

Declared In

AMZNAuthorizationManager.h

  region

This property is used to decide which region to use. Set this value to one of the constants defined as part of the enum AMZNRegion.

@property (nonatomic) AMZNRegion region

Availability

3.0

Discussion

This property is used to decide which region to use. Set this value to one of the constants defined as part of the enum AMZNRegion.

Declared In

AMZNAuthorizationManager.h

+ sharedManager

+ (instancetype)sharedManager

– authorize:withHandler:

This method is used to get authorization from an user. The method accepts input in AMZNAuthorizeRequest type.

- (void)authorize:(AMZNAuthorizeRequest *)request withHandler:(AMZNAuthorizationRequestHandler)handler

Availability

3.0

Discussion

This method is used to get authorization from an user. The method accepts input in AMZNAuthorizeRequest type.

The result is passed into the AMZNAuthorizationRequestHandler block callback. If success, the result object will contain a valid access token with permissions to requested scopes.

If failed, the block callback will return an NSError object with corresponding error code and error domain.

Declared In

AMZNAuthorizationManager.h

– signOut:

Deletes cached user tokens and other data. Use this method to logout a user.

- (void)signOut:(AMZNSignOutRequestHandler)handler

Availability

3.0

Discussion

Deletes cached user tokens and other data. Use this method to logout a user.

This method removes the authorization tokens from the Keychain. It also clears the cookies from the local cookie storage and the server side authentication state to clear the authorization state of the users who checked the “Keep me signed in” checkbox.

The result is passed into the AMZNSignOutRequestHandler block callback. If failed. the block callback will return an NSError object with corresponding error code and error domain.

Declared In

AMZNAuthorizationManager.h

+ handleOpenURL:sourceApplication:

Helper function for authorize:withHandler:.

+ (BOOL)handleOpenURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication

Parameters

url

The url received in the [UIApplicationDelegate application:openURL:sourceApplication:annotation] delegate method.

sourceApplication

The sourceApplication received in the [UIApplicationDelegate application:openURL:sourceApplication:annotation] delegate method.

Return Value

Returns YES if the url passed in was a valid url for the SDK and NO if the url was not valid.

Availability

3.0

Discussion

Helper function for authorize:withHandler:.

Call this function from your implementation of the [UIApplicationDelegate application:openURL:sourceApplication:annotation] delegate. This method handles the [UIApplicationDelegate application:openURL:sourceApplication:annotation] call from the Safari web browser. The app should be calling this function when it receives a call to [UIApplicationDelegate application:openURL:sourceApplication:annotation], passing in the url and the sourceApplication. If app fails to do so, the SDK will not be able to complete the login flow.

The SDK validates the url parameter to see if it is valid for the SDK. It is possible the app may want to handle the url as well, in which case the app should first call the SDK to see if this url is a callback from Safari and if the SDK wants to process it. After processing, the SDK will return its preference and the app can then process the url if it chooses. Any error arising from this API is reported through the failure delegate used for the authorizeUserForScopes:delegate: call.

See Also

  • See authorizeUserForScopes:delegate: for more discussion on how to work with this API to complement the login work flow.

Declared In

AMZNAuthorizationManager.h