From 4686dddefebf42acb638b7a975db998a38080dff Mon Sep 17 00:00:00 2001 From: Vojtech Novak Date: Sun, 7 Sep 2025 18:50:02 +0200 Subject: [PATCH] docs: clearCachedAccessToken --- docs/api/index.mdx | 45 +++++++++++++++++++++++---------------------- docs/migrating.md | 4 ++-- docs/one-tap.mdx | 8 ++++++++ 3 files changed, 33 insertions(+), 24 deletions(-) diff --git a/docs/api/index.mdx b/docs/api/index.mdx index e82a4b2..59d771b 100644 --- a/docs/api/index.mdx +++ b/docs/api/index.mdx @@ -51,7 +51,7 @@ Parameters for enabling [App Check](/docs/security#appcheck). Provide `debugProv `webClientId` is the most important parameter in the configuration. It is required. -#### Type declaration +#### Type Declaration | Name | Type | Description | | ------------------- | --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | @@ -68,7 +68,7 @@ Parameters for enabling [App Check](/docs/security#appcheck). Provide `debugProv > **OneTapCreateAccountParams** = [`OneTapSignInParams`](#onetapsigninparams) & \{ `accountName?`: `string`; `requestVerifiedPhoneNumber?`: `boolean`; \} -#### Type declaration +#### Type Declaration | Name | Type | Description | | ----------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | @@ -81,7 +81,7 @@ Parameters for enabling [App Check](/docs/security#appcheck). Provide `debugProv > **OneTapExplicitSignInParams** = [`OneTapSignInParams`](#onetapsigninparams) & \{ `accountName?`: `string`; \} -#### Type declaration +#### Type Declaration | Name | Type | Description | | -------------- | -------- | ------------------------------------------------------------------------------------------------------- | @@ -109,7 +109,7 @@ The response object for OneTap's `signIn` and `createAccount`. Learn more about additional web-only parameters at [Google's reference documentation](https://developers.google.com/identity/gsi/web/reference/js-reference#IdConfiguration). -#### Type declaration +#### Type Declaration | Name | Type | Description | | ------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | @@ -197,19 +197,20 @@ The entry point of the Universal Sign In API, exposed as `GoogleOneTapSignIn`. On the web, the signatures of `signIn`, `presentExplicitSignIn`, and `createAccount` are callback-based and on native they are Promise-based. Read more in the [guide](/docs/one-tap#web-support). -#### Type declaration - -| Name | Type | -| ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `configure` | (`params`: [`OneTapConfigureParams`](#onetapconfigureparams)) => `void` | -| `checkPlayServices` | (`showErrorResolutionDialog`?: `boolean`) => `Promise`\<[`PlayServicesInfo`](#playservicesinfo)\> | -| `enableAppCheck` | (`params`?: [`EnableAppCheckParams`](#enableappcheckparams)) => `Promise`\<`null`\> | -| `signIn` | (`params?`: [`OneTapSignInParams`](#onetapsigninparams)) => `Promise`\<[`OneTapResponse`](#onetapresponse)\> | -| `createAccount` | (`params?`: [`OneTapCreateAccountParams`](#onetapcreateaccountparams)) => `Promise`\<[`OneTapResponse`](#onetapresponse)\> | -| `presentExplicitSignIn` | (`params?`: [`OneTapExplicitSignInParams`](#onetapexplicitsigninparams)) => `Promise`\<[`OneTapExplicitSignInResponse`](#onetapexplicitsigninresponse)\> | -| `requestAuthorization` | (`options`: [`RequestAuthorizationParams`](#requestauthorizationparams)) => `Promise`\<[`AuthorizationResponse`](#authorizationresponse)\> | -| `signOut` | () => `Promise`\<`null`\> | -| `revokeAccess` | (`emailOrUniqueId`: `string`) => `Promise`\<`null`\> | +#### Type Declaration + +| Name | Type | +| -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- | +| `configure` | (`params`: [`OneTapConfigureParams`](#onetapconfigureparams)) => `void` | +| `checkPlayServices` | (`showErrorResolutionDialog`?: `boolean`) => `Promise`\<[`PlayServicesInfo`](#playservicesinfo)\> | +| `enableAppCheck` | (`params`?: [`EnableAppCheckParams`](#enableappcheckparams)) => `Promise`\<`null`\> | +| `signIn` | (`params?`: [`OneTapSignInParams`](#onetapsigninparams)) => `Promise`\<[`OneTapResponse`](#onetapresponse)\> | +| `createAccount` | (`params?`: [`OneTapCreateAccountParams`](#onetapcreateaccountparams)) => `Promise`\<[`OneTapResponse`](#onetapresponse)\> | +| `clearCachedAccessToken()` | (`tokenString`: `string`) => `Promise`\<`null`\> | `GoogleSignin.clearCachedAccessToken` | +| `presentExplicitSignIn` | (`params?`: [`OneTapExplicitSignInParams`](#onetapexplicitsigninparams)) => `Promise`\<[`OneTapExplicitSignInResponse`](#onetapexplicitsigninresponse)\> | +| `requestAuthorization` | (`options`: [`RequestAuthorizationParams`](#requestauthorizationparams)) => `Promise`\<[`AuthorizationResponse`](#authorizationresponse)\> | +| `signOut` | () => `Promise`\<`null`\> | +| `revokeAccess` | (`emailOrUniqueId`: `string`) => `Promise`\<`null`\> | ## Original Google sign in @@ -229,7 +230,7 @@ On the web, the signatures of `signIn`, `presentExplicitSignIn`, and `createAcco > **ConfigureParams** = [`ClientIdOrPlistPath`](#clientidorplistpath) & \{ `accountName?`: `string`; `forceCodeForRefreshToken?`: `boolean`; `hostedDomain?`: `string`; `offlineAccess?`: `boolean`; `openIdRealm?`: `string`; `profileImageSize?`: `number`; `scopes?`: `string`[]; `webClientId?`: `WebClientId`; \} -#### Type declaration +#### Type Declaration | Name | Type | Description | | --------------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | @@ -338,7 +339,7 @@ The response object when the user signs in successfully. The entry point of the Google Sign In API, exposed as `GoogleSignin`. -#### Type declaration +#### Type Declaration | Name | Type | | -------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | @@ -500,7 +501,7 @@ if (isSuccessResponse(response)) { > **GoogleSigninButtonProps** = `ViewProps` & \{ `color?`: `"dark"` \| `"light"`; `disabled?`: `boolean`; `onPress?`: () => `void`; `size?`: `number`; \} -#### Type declaration +#### Type Declaration | Name | Type | | ------------ | --------------------- | @@ -515,7 +516,7 @@ if (isSuccessResponse(response)) { > **WebGoogleSignInButtonProps** = `Omit`\<`GsiButtonConfiguration`, `"logo_alignment"`\> & \{ `logoAlignment?`: `GsiButtonConfiguration`\[`"logo_alignment"`\]; `onError?`: (`error`: `Error`) => `void`; \} -#### Type declaration +#### Type Declaration | Name | Type | | ---------------- | ---------------------------------------------- | @@ -585,7 +586,7 @@ You can specify a different bundle path for the config file, e.g. "GoogleService Alternatively, set the client ID explicitly by providing `iosClientId`. -#### Type declaration +#### Type Declaration \{ `iosClientId?`: `string`; \} diff --git a/docs/migrating.md b/docs/migrating.md index d4709c9..917bea5 100644 --- a/docs/migrating.md +++ b/docs/migrating.md @@ -22,11 +22,11 @@ Migrating from Original to Universal module is mostly about changing the method | `signOut` | `signOut` | | | `revokeAccess` | `revokeAccess` | Universal requires email/id parameter on web. | | `hasPreviousSignIn` | Use `signIn` response | Check for `noSavedCredentialFound` response type. | -| `clearCachedAccessToken` | Not provided, presumably not needed. | - | +| `clearCachedAccessToken` | `clearCachedAccessToken` | Same functionality. | --- -## Migrating to new JS API +## Migrating to the new JS API Version 13 introduced a new JS API, which changes some method response signatures and makes minor changes to error handling (details [here](https://github.com/react-native-google-signin/google-signin/pull/1326)). If you're upgrading from version 12 or earlier, you'll need to make some minor adjustments. diff --git a/docs/one-tap.mdx b/docs/one-tap.mdx index 7b6dec7..aa01b61 100644 --- a/docs/one-tap.mdx +++ b/docs/one-tap.mdx @@ -277,6 +277,14 @@ import RequestAuthorization from './screenshots/_requestAuthorization.mdx'; +--- + +### `clearCachedAccessToken` + +signature: (`accessTokenString`: `string`) => `Promise`\<`null`\> + +This method is only needed on Android. You may run into a `401 Unauthorized` error when an access token is invalid. Call this method to remove the token from local cache and then call `requestAuthorization()` to get a fresh access token. Calling this method on Apple does nothing and always resolves. This is because on Apple, `requestAuthorization()` always returns valid tokens, refreshing them first if they have expired or are about to expire (see [docs](https://developers.google.com/identity/sign-in/ios/reference/Classes/GIDGoogleUser#-refreshtokensifneededwithcompletion:)). + ## Automatic `webClientId` & `iosClientId` detection {#automatic-config} If you use Expo (with the config plugin and prebuild), or if you're using Firebase, you don't need to provide the `iosClientId` parameter to the `configure` method.