shouldAuthorize

fun shouldAuthorize(context: Context, account: AccountInfo, callback: (Boolean) -> Unit)

Determines whether the host application should perform the authorization flow before starting a chat with the given account.

Use the result to decide whether to show your login UI or to start the chat directly. When the deployment is configured for authentication and no valid stored authentication exists, the callback receives true. Otherwise it receives false.

Usage:

AuthenticationStatus.shouldAuthorize(context, account) { shouldAuthorize ->
if (shouldAuthorize) {
startLoginFlow()
} else {
startChat(account)
}
}

Parameters

context

An Android Context used to access stored authentication state.

account

The account configuration to evaluate (typically a com.genesys.cloud.integration.messenger.MessengerAccount).

callback

Invoked with true if the host should authorize before starting the chat, false otherwise.