authenticateSuspend

public final AuthenticationObject authenticateSuspend(Context context, String authCode)

Method that will try to authenticate with given authCode String value.

Sample usage:

lifecycleScope.launch {
    try {
        val authenticationObject = PingOne.authenticate(context, authenticationCode)
        if (authenticationObject != null) {
            // Continue the flow according to the authentication object status, for example:
            if (authenticationObject.status == "EXPIRED") {
                // Handle expired authentication
                return@launch
            }
            if (authenticationObject.needsApproval == "REQUIRED") {
                // Ask the user to approve the authentication, trigger approve/deny methods
                // of the AuthenticationObject accordingly
            }
        }
    } catch (e: PingOneSDKException) {
        // Handle error
        Log.e("PingOne", "Authentication failed: ${e.error.message}")
    }
}

Return

AuthenticationObject if authentication was successful, null otherwise

Parameters

context

The context of the calling application

authCode

The authentication code String parsed from QR or manual input.

See also

Throws

if the operation fails