authorize

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

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

Parameters

activity

The Activity to launch the authorization request Intent.

completion

The block to be called when the request is completed including either a valid accessToken or Throwable.

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

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

Parameters

fragment

The Fragment to launch the authorization request Intent.

completion

The block to be called when the request is completed including either a valid accessToken or Throwable.

fun authorize(completedActivity: Class<*>, canceledActivity: Class<*>)

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

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

fun authorize(): Intent

Creates an authorization 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 handleAuthorizationResponse in ActivityResultCallback if Activity Result API was used or in android.app.Activity.onActivityResult if android.app.Activity.startActivityForResult was used when the authorization result is returned from Chrome Custom Tab.