How mobile client should integrate with Salto KS

Created by Daniil Stasiuk, Modified on Fri, 27 May, 2022 at 1:09 PM by Daniil Stasiuk

If you are developing a mobile app, which will allow Salto KS users to login with their Salto KS account, then probably you would need to authenticate with Salto KS IDS with Oauth2.0 in authorization code flow.


In Salto KS app, we use AppAuth, which is the open source library handles the authorization part for you: https://openid.github.io/AppAuth-iOS


But you can find alternative libraries do the same for you.


If we take Salto KS iOS app as the example, we have set a redirect url: nl.moboa.xxxx:/xxxxxxxxdirect/redirect (Sensitive part is omitted)


The redirect url in mobile client is different from web url, you can find more here: https://developer.apple.com/documentation/xcode/allowing_apps_and_websites_to_link_to_your_content/defining_a_custom_url_scheme_for_your_app


Inside the target settings, there is an info tab and under URL Types, we have this:



Once user is successfully logged in they should get callback inside UIApplicationDelegate class, this is method that will be calledfunc application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool


The library you are using is going to provide code that handles that, for us it’s something like this:flow.resumeExternalUserAgentFlow(with: url)


After that they need to exchange that for token (this is also handled by library)After that they have access token -> execute api calls



AppAuth configuration

After installed AppAuth library, open AppAuthExampleViewController.m
And update the client id, issuer and redirect url:

static NSString *const kIssuer = @“https://clp-accept-identityserver.my-clay.com”;
static NSString *const kClientID = @“xxxxxxxxxxxx”;
static NSString *const kRedirectURI = @“com.example.app:/oauth2redirect/redirect”;


You should update the settings depends on your project, app and the settings saved with Salto KS IDS, the example here is for Accept environment.


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article