ForgeRock SDKs

Generate one time passwords

Obtain the current and next tokens by using the OathTokenCode object, which is available by calling OathMechanism.generateCode():

do {
    // Generate OathTokenCode
    let code = try mechanism.generateCode()
    // Update UI with generated code
    codeLabel?.text = code.code
} catch {
    // Handle errors for generating OATH code
}

The user sees something like this:

HOTP code in iOS
Copyright © 2010-2022 ForgeRock, all rights reserved.