Reply to push notification

This topic explains how to set up the reply to the push notification. Complete this step if you are using the Identity Platform MFA methods push-to-accept, symbol-to-accept, or biometric. If you are using only TOTP, see "Generate offline TOTP" for steps.

At this point in the workflow, the end user has received a push notification and must send an accept or deny reply.

In the following code, check the pushType to see the interface to show end users. Additionally, the following code configures the BPAN (Biometric Push Accept Notification) and SPAN (Symbol Push Accept Notification) push types to display the correct flow. It also uses the IdpService to respond to the push notification.

fun onAcceptNotification(notification: SecureAuthNotification) {
    if (notification.pushType == SecureAuthNotification.PUSH_TYPE_BPAN) {
        launchBiometric(notification)
    } else if (notification.pushType == SecureAuthNotification.PUSH_TYPE_SPAN) {
        showSymbols(notification)
    } else replyPushNotification(notification, RESPONSE_ACCEPT)
}
 
fun onDenyNotification(notification: SecureAuthNotification) {
    replyPushNotification(notification, RESPONSE_DENY)
}
 
fun launchBiometric(notification: SecureAuthNotification) {
    // Launch a biometric validation
    // After validation, confirm push notification reply with RESPONSE_ACCEPT
    // replyPushNotification(notification, RESPONSE_ACCEPT)
}
 
fun showSymbols(notification: SecureAuthNotification) {
    // Show symbols for user selection from notification.symbols
    // Send a reply with the symbol selected as response
    // replyPushNotification(notification, symbol)
}
 
fun replyPushNotification(notification: SecureAuthNotification, response: String) {
    // Execute this inside a Kotlin couroutine
    couroutineScope.launch {
        IdpService().sendLoginRequest(context, notification.cloud, notification.requestId, response)
    }
}

Next steps

Manage enrolled accounts