Skip to main content

API Reference - iOS

Create an SDK Instance#

import LoginIDSDK

The LoginID API must be called before any other APIs. You should call this API within your AppDelegate's didFinishLaunchingWithOptions method.

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// clientId example 032690b3-9bc4-4602-87c1-60c1fae782f2
let clientId="<your api key>"
// baseURL example https://060ce487-b934-43d0-a925-b66e80c7532f.native-api.auth.loginid.id
let baseURL="<your base url"
LoginApi.client.configure(clientId: clientId, baseURL: baseURL)
...
...
}
...
...

registerWithFido2#

Sign up a user for FIDO authentication.

@objc(registerWithFido2:options:onComplete:) public func registerWithFido2(username: String?, options: RegistrationOptions?, onComplete: @escaping(RegisterResponse)->Void)

ParameterTypeRequiredDetails
usernamestringtrueUsername of the customer to be registered.
optionsRegistrationOptionsoptionalAPI Service token signed by your Private Key, as per the API Credential added to the integration. \nRegistrationOptions.buildAuth(token: authToken)
onComplete@callbacktrueCallback function to handle returning results (RegisterResponse)

registerWithPassword#

Creates a user account with a password (not recommended). If leveraging this method, users should be migrating to use a FIDO authenticator, then have their password revoked.

@objc (registerWithPassword:password:confirmPassword:options:onComplete:) public func registerWithPassword(username:String, password: String, confirmPassword:String, options: RegistrationOptions?, onComplete: @escaping(RegisterResponse)->Void)

ParameterTypeRequiredDetails
usernamestringtrueUsername of the customer to be registered.
passwordstringtruePassword of the customer to be registered.
passwordConfirmationstringtrueIt is best practice to have the customer enter their password twice before creating their profile to prevent typos. If desired, you could only require the end user to enter their password once and pass that password in both fields.
optionsRegistrationOptionsoptionalAPI Service token signed by your Private Key, as per the API Credential added to the integration. \nRegistrationOptions.buildAuth(token: authToken)
onComplete@callbacktrueCallback function to handle returning results (RegisterResponse)

authenticateWithFido2#

Authenticate a previously registered user through FIDO2.

@objc(authenticateWithFido2:options:onComplete:) public func authenticateWithFido2(username: String, options: AuthenticationOptions?, onComplete: @escaping(AuthenticateResponse)->Void)

ParameterTypeRequiredDetails
usernamestringtrueUsername of the customer to be authenticated.
optionsAuthenticationOptionsoptionalAPI Service token signed by your Private Key, as per the API Credential added to the integration. \nAuthenticationOptions.buildAuth(token: authToken)
onComplete@callbacktrueCallback function to handle returning results (AuthenticateResponse)

authenticateWithPassword#

Authenticate a previously registered user using username and password.

@objc (authenticateWithPassword:password:options:onComplete:) public func authenticateWithPassword(username:String, password: String, options: AuthenticationOptions?, onComplete: @escaping(AuthenticateResponse)->Void)

ParameterTypeRequiredDetails
usernamestringtrueUsername of the customer to be authenticated.
passwordstringtruePassword of the customer to be authenticated.
optionsAuthenticationOptionsoptionalAPI Service token signed by your Private Key, as per the API Credential added to the integration. \nAuthenticationOptions.buildAuth(token: authToken)
onComplete@callbacktrueCallback function to handle returning results (AuthenticateResponse)

confirmTransaction#

Coming Soon

@objc(transactionConfirmation:payload:options:vieController:onComplete:) public func transactionConfirmation(username: String, payload: TransactionPayload, options: TransactionOptions?, viewController: UIViewController, onComplete:@escaping(TransactionConfirmationResponse)->Void)

| username | string | true | Username of the customer confirming the transaction. | | payload | TransactionPayload | true | Require a client side generated nonce value and a text message to display back to user for confirmation \n TransactionPayload.buildText(nonce: nonce, data: payload) | | options | AuthenticationOptions | optional | API Service token signed by your Private Key, as per the API Credential added to the integration. \nAuthenticationOptions.buildAuth(token: authToken) | | viewController | UIViewController | true | The presenting view controller where the transaction is called from | | onComplete | @callback | true | Callback function to handle returning results (TransactionConfirmationResponse)|

isLoggedIn#

Check if a given user is currently logged in.

logout#

Deprecated Methods#

The iOS SDK previously had the following methods:

  • .register()
  • .login()

The methods have been deprecated, as the type of authenticator is now specified in the register and authenticate methods.