OneTapBottomSheet

fun OneTapBottomSheet(modifier: Modifier = Modifier, state: OneTapBottomSheetState = rememberOneTapBottomSheetState(), serviceName: String, scenario: OneTapScenario = OneTapScenario.EnterService, autoHideOnSuccess: Boolean = true, onAuth: (oAuth: OneTapOAuth?, accessToken: AccessToken) -> Unit, onAuthCode: (data: AuthCodeData, isCompletion: Boolean) -> Unit = { _, _ -> }, onFail: (oAuth: OneTapOAuth?, fail: VKIDAuthFail) -> Unit = { _, _ -> }, oAuths: Set<OneTapOAuth> = emptySet(), style: OneTapBottomSheetStyle = OneTapBottomSheetStyle.Light(), authParams: VKIDAuthUiParams = VKIDAuthUiParams {}, fastAuthEnabled: Boolean = true)

Composable function to display a bottom sheet for VKID One Tap authentication with multibranding.

Parameters

modifier

Modifier for this composable.

state

The state of the bottom sheet. To control sheet create state instance with rememberOneTapBottomSheetState and pass it here.

serviceName

The name of the service for authentication. Will be displayed as title of sheet.

scenario

The OneTapScenario under which the authentication is being performed. It reflects on the texts of the button and sheet.

autoHideOnSuccess

Automatically hide the sheet on successful authentication.

onAuth

Callback function invoked on successful authentication with an OneTapOAuth and an AccessToken. The first parameter is the OAuth which was used for authorization or null if the main flow with OneTap was used. The second parameter is the access token to be used for working with VK API.

onAuthCode

A callback to be invoked upon successful first step of auth - receiving auth code which can later be exchanged to access token. isCompletion is true if onAuth won't be called. This will happen if you passed auth parameters and implement their validation yourself. In that case we can't exchange auth code for access token and you should do this yourself.

onFail

Callback function invoked on authentication failure with an OneTapOAuth and a VKIDAuthFail object. The first parameter is the OAuth which was used for authorization or null if the main flow with OneTap was used. The second parameter is the error which happened during authorization.

style

The OneTapBottomSheetStyle of the bottom sheet. Default is OneTapBottomSheetStyle.Light

authParams

Optional params to be passed to auth. See VKIDAuthUiParams.Builder for more info.

fastAuthEnabled

Whether to fetch user. Defaults to true. In case this parameter is set to false the user data won't be fetched and user will have to confirm authorization on click. Note: this parameter doesn't support changes in runtime. Note: This parameter will hide "change account" button because in this case OneTap will have the same behaviour.


fun OneTapBottomSheet(modifier: Modifier = Modifier, state: OneTapBottomSheetState = rememberOneTapBottomSheetState(), serviceName: String, scenario: OneTapScenario = OneTapScenario.EnterService, autoHideOnSuccess: Boolean = true, onAuth: (oAuth: OneTapOAuth?, accessToken: AccessToken) -> Unit, onAuthCode: (data: AuthCodeData, isCompletion: Boolean) -> Unit = { _, _ -> }, onFail: (oAuth: OneTapOAuth?, fail: VKIDAuthFail) -> Unit = { _, _ -> }, oAuths: Set<OneTapOAuth> = emptySet(), style: OneTapBottomSheetStyle = OneTapBottomSheetStyle.Light(), authParams: VKIDAuthUiParams = VKIDAuthUiParams {}, fastAuthEnabled: Boolean = true, autoShowSheetDelayMillis: Long? = null)

Composable function to display a bottom sheet for VKID One Tap authentication with multibranding.

Parameters

modifier

Modifier for this composable.

state

The state of the bottom sheet. To control sheet create state instance with rememberOneTapBottomSheetState and pass it here.

serviceName

The name of the service for authentication. Will be displayed as title of sheet.

scenario

The OneTapScenario under which the authentication is being performed. It reflects on the texts of the button and sheet.

autoHideOnSuccess

Automatically hide the sheet on successful authentication.

onAuth

Callback function invoked on successful authentication with an OneTapOAuth and an AccessToken. The first parameter is the OAuth which was used for authorization or null if the main flow with OneTap was used. The second parameter is the access token to be used for working with VK API.

onAuthCode

A callback to be invoked upon successful first step of auth - receiving auth code which can later be exchanged to access token. isCompletion is true if onAuth won't be called. This will happen if you passed auth parameters and implement their validation yourself. In that case we can't exchange auth code for access token and you should do this yourself.

onFail

Callback function invoked on authentication failure with an OneTapOAuth and a VKIDAuthFail object. The first parameter is the OAuth which was used for authorization or null if the main flow with OneTap was used. The second parameter is the error which happened during authorization.

style

The OneTapBottomSheetStyle of the bottom sheet. Default is OneTapBottomSheetStyle.Light

authParams

Optional params to be passed to auth. See VKIDAuthUiParams.Builder for more info.

fastAuthEnabled

Whether to fetch user. Defaults to true. In case this parameter is set to false the user data won't be fetched and user will have to confirm authorization on click. Note: this parameter doesn't support changes in runtime. Note: This parameter will hide "change account" button because in this case OneTap will have the same behaviour.

autoShowSheetDelayMillis

Delay in millis after which sheet will be automatically shown. Examples:

  • null: not shown automatically

  • 0: shown automatically immediately

  • 1000: show automatically after 1 second