endSession

suspend fun endSession(activity: AppCompatActivity, completion: (Completion<Unit>) -> Unit = {})

Sends an end session request to the authorization service, using a Chrome Custom Tab and handles the end session response automatically.

Parameters

activity

The Activity to launch the end session request Intent.

completion

The block to be called when the session has been reset or a Throwable when an exception occurred.

suspend fun endSession(fragment: Fragment, completion: (Completion<Unit>) -> Unit = {})

Sends an end session request to the authorization service, using a Chrome Custom Tab and handles the end session response automatically.

Parameters

fragment

The Fragment to launch the end session request Intent.

completion

The block to be called when the session has been reset or a Throwable when an exception occurred.

fun endSession(completedActivity: Class<*>, canceledActivity: Class<*>): Boolean

Sends an end session request to the authorization service, using a Chrome Custom Tab. Upon completion of this end session request, a PendingIntent of the completedActivity will be invoked. If the user cancels the end session request, a PendingIntent of the canceledActivity will be invoked.

Note: Call handleEndSessionResponse in completedActivity or canceledActivity when the intent is returned from Chrome Custom Tab.

Return

True if an end session request could be performed, false otherwise (due to an invalid session).

fun endSession(): Intent?

Creates an end session request Intent that can be launched using the Activity Result API and a StartActivityForResult contract or with android.app.Activity.startActivityForResult to open a Chrome Custom Tab.

Note: Call handleEndSessionResponse in ActivityResultCallback if Activity Result API was used or in android.app.Activity.onActivityResult if android.app.Activity.startActivityForResult was used when the end session result is returned from Chrome Custom Tab.

Return

The end session request Intent or null, if none could be created due to an invalid session.