Inherits from NSObject
Declared in LUDeepLinkAuth.h
LUDeepLinkAuth.m

Overview

Deep Link Authorization allows you to request an access token from a LevelUp user using an app-switching model: the user will be deep linked into the LevelUp app, where they will be presented with a dialog describing the request. Upon responding to this request, the user will be bounced back into the requesting app.

A request includes a list of permissions, such as the ability to create orders or to access their transaction history. An up-to-date list of permissions is available on the LevelUp Developer Portal.

An authorization request is made using authorizeWithPermissions:returnURLScheme:. If there is a failure at any point in the request, a LUDeepLinkAuthErrorNotification notification will be sent. If this happens, the user info for the notification will contain an NSError instance under the key LUDeepLinkAuthNotificationErrorKey. This error will have LUDeepLinkAuthErrorDomain as the domain, and an appropriate value of LUDeepLinkAuthErrorCode as its code.

In order for the SDK to handle the reponse back from the LevelUp app, a call to handleOpenURL:sourceApplication: must be made from your app delegate’s application:openURL:sourceApplication:annotation: method.

When a request succeeds, an LUDeepLinkAuthSuccessNotification will be sent. The user info for the notification will contain an access token string under the key LUDeepLinkAuthNotificationAccessTokenKey. Setting accessToken on [LUAPIClient sharedClient] to this token will allow the access token to be used on subsequent LevelUp API calls.

Class Methods

authorizeWithPermissions:returnURLScheme:

Request the user to authorize using deep linking.

+ (void)authorizeWithPermissions:(NSArray *)permissions returnURLScheme:(NSString *)returnURLScheme

Parameters

permissions

An array of strings, where each each string is the name of a requested permission. See http://developer.thelevelup.com/getting-started/permissions-list for a list of possible permissions.

returnURLScheme

The URL scheme to use in order to return the user to your app. This must be one of the custom URL schemes configured for your app. For more information, refer to Apple’s documentation: https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/AdvancedAppTricks/AdvancedAppTricks.html#//apple_ref/doc/uid/TP40007072-CH7-SW50

Discussion

Request the user to authorize using deep linking.

Declared In

LUDeepLinkAuth.h

handleOpenURL:sourceApplication:

This method must be called from the application:openURL:sourceApplication:annotation: method of your app delegate. Doing so allows the response from an auth request to be validated and completed.

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

Parameters

URL

The url passed to application:openURL:sourceApplication:annotation:.

sourceApplication

The sourceApplication passed to application:openURL:sourceApplication:annotation:.

Return Value

YES If this URL was handled by the LevelUp SDK, else NO.

Discussion

This method must be called from the application:openURL:sourceApplication:annotation: method of your app delegate. Doing so allows the response from an auth request to be validated and completed.

Declared In

LUDeepLinkAuth.h

isDeepLinkAuthAppInstalled

Check if the Deep Link Auth app (LevelUp by default) is installed on the device.

+ (BOOL)isDeepLinkAuthAppInstalled

Discussion

Check if the Deep Link Auth app (LevelUp by default) is installed on the device.

Declared In

LUDeepLinkAuth.h