Skip to main content

User Authentication

Restrict usage/send update notifications


DeployGate SDK can identify specific users who are using a distributed app. This allows notifications about the latest revisions to be sent to users who have app installation privileges.

There are many circumstances in which you would want to limit distributions of test revisions of apps to select users.

Additionally, DeployGate SDK provides several functions to check if a user has permission to use an app. For example, it’s possible to see if an app is on the list of apps approved for use by a particular user.

Configuring Settings

  1. Register the custom URL scheme with the project

Go to the app page within DeployGate to obtain the custom URL scheme.

Screenshot of iOS user authentication

Open the project in Xcode and go to TARGETS → Info → URL Types to register the custom URL scheme.

Screenshot of iOS user authentication

  1. Turn on user authentication and embed SDK

AppDelegate class is to be edited. In launchApplicationWithAuthor , which was added when the SDK was installed, add userInfomationEnabled option.

Swift
DeployGateSDK
.sharedInstance()
.launchApplication(withAuthor: "${USERNAME}", key: "${API_KEY}", userInfomationEnabled: true)
Objective-C
[[DeployGateSDK sharedInstance] launchApplicationWithAuthor:@"${USERNAME}" key:@"${API_KEY}" userInfomationEnabled:YES];
  1. Pass user information to SDK

Add the following line to AppDelegate as application:openURL:sourceApplication:annotation: so that the SDK can use the user information.

Swift
func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
return DeployGateSDK.sharedInstance().handleOpen(url as URL?, sourceApplication: sourceApplication, annotation: annotation)
}
Objective-C
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
return [[DeployGateSDK sharedInstance] handleOpenUrl:url sourceApplication:sourceApplication annotation:annotation]; // Add this line
}

The SDK will now check for updates when launching the app. Additionally, userAuthorizationWithCompletionHandler: can now be used to check if a user has the appropriate app usage permissions.