UserVerificationProvider
typealias UserVerificationProvider = com.salesforce.android.smi.network.api.auth.UserVerificationProvider
Callback that provides a JWT for user verification when the SDK issues a challenge.
The SDK calls this provider whenever it needs a fresh or renewed identity token to authenticate the end user with the messaging service. The ChallengeReason indicates why a new token is needed (initial auth, renewal, expiration, or malformed token).
Register via CoreClient.registerUserVerificationProvider.
Samples
coreClient.registerUserVerificationProvider { reason ->
when (reason) {
ChallengeReason.INITIAL -> {
// Fetch a fresh JWT from your auth service
UserVerificationToken.externalToken("jwt-token")
}
ChallengeReason.RENEW, ChallengeReason.EXPIRED -> {
// Renew the existing token
UserVerificationToken.externalToken("renewed-jwt-token")
}
ChallengeReason.MALFORMED -> {
// Token was invalid, fetch a fresh one
UserVerificationToken.externalToken("new-jwt-token")
}
}
}Content copied to clipboard