Skip to content

Commit 0204dd4

Browse files
authored
docs: clearCachedAccessToken (#79)
1 parent 7885d2e commit 0204dd4

3 files changed

Lines changed: 33 additions & 24 deletions

File tree

docs/api/index.mdx

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Parameters for enabling [App Check](/docs/security#appcheck). Provide `debugProv
5151
5252
`webClientId` is the most important parameter in the configuration. It is required.
5353

54-
#### Type declaration
54+
#### Type Declaration
5555

5656
| Name | Type | Description |
5757
| ------------------- | --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
@@ -68,7 +68,7 @@ Parameters for enabling [App Check](/docs/security#appcheck). Provide `debugProv
6868

6969
> **OneTapCreateAccountParams** = [`OneTapSignInParams`](#onetapsigninparams) & \{ `accountName?`: `string`; `requestVerifiedPhoneNumber?`: `boolean`; \}
7070
71-
#### Type declaration
71+
#### Type Declaration
7272

7373
| Name | Type | Description |
7474
| ----------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
@@ -81,7 +81,7 @@ Parameters for enabling [App Check](/docs/security#appcheck). Provide `debugProv
8181

8282
> **OneTapExplicitSignInParams** = [`OneTapSignInParams`](#onetapsigninparams) & \{ `accountName?`: `string`; \}
8383
84-
#### Type declaration
84+
#### Type Declaration
8585

8686
| Name | Type | Description |
8787
| -------------- | -------- | ------------------------------------------------------------------------------------------------------- |
@@ -109,7 +109,7 @@ The response object for OneTap's `signIn` and `createAccount`.
109109
110110
Learn more about additional web-only parameters at [Google's reference documentation](https://developers.google.com/identity/gsi/web/reference/js-reference#IdConfiguration).
111111

112-
#### Type declaration
112+
#### Type Declaration
113113

114114
| Name | Type | Description |
115115
| ------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
@@ -197,19 +197,20 @@ The entry point of the Universal Sign In API, exposed as `GoogleOneTapSignIn`.
197197

198198
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).
199199

200-
#### Type declaration
201-
202-
| Name | Type |
203-
| ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
204-
| `configure` | (`params`: [`OneTapConfigureParams`](#onetapconfigureparams)) => `void` |
205-
| `checkPlayServices` | (`showErrorResolutionDialog`?: `boolean`) => `Promise`\<[`PlayServicesInfo`](#playservicesinfo)\> |
206-
| `enableAppCheck` | (`params`?: [`EnableAppCheckParams`](#enableappcheckparams)) => `Promise`\<`null`\> |
207-
| `signIn` | (`params?`: [`OneTapSignInParams`](#onetapsigninparams)) => `Promise`\<[`OneTapResponse`](#onetapresponse)\> |
208-
| `createAccount` | (`params?`: [`OneTapCreateAccountParams`](#onetapcreateaccountparams)) => `Promise`\<[`OneTapResponse`](#onetapresponse)\> |
209-
| `presentExplicitSignIn` | (`params?`: [`OneTapExplicitSignInParams`](#onetapexplicitsigninparams)) => `Promise`\<[`OneTapExplicitSignInResponse`](#onetapexplicitsigninresponse)\> |
210-
| `requestAuthorization` | (`options`: [`RequestAuthorizationParams`](#requestauthorizationparams)) => `Promise`\<[`AuthorizationResponse`](#authorizationresponse)\> |
211-
| `signOut` | () => `Promise`\<`null`\> |
212-
| `revokeAccess` | (`emailOrUniqueId`: `string`) => `Promise`\<`null`\> |
200+
#### Type Declaration
201+
202+
| Name | Type |
203+
| -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- |
204+
| `configure` | (`params`: [`OneTapConfigureParams`](#onetapconfigureparams)) => `void` |
205+
| `checkPlayServices` | (`showErrorResolutionDialog`?: `boolean`) => `Promise`\<[`PlayServicesInfo`](#playservicesinfo)\> |
206+
| `enableAppCheck` | (`params`?: [`EnableAppCheckParams`](#enableappcheckparams)) => `Promise`\<`null`\> |
207+
| `signIn` | (`params?`: [`OneTapSignInParams`](#onetapsigninparams)) => `Promise`\<[`OneTapResponse`](#onetapresponse)\> |
208+
| `createAccount` | (`params?`: [`OneTapCreateAccountParams`](#onetapcreateaccountparams)) => `Promise`\<[`OneTapResponse`](#onetapresponse)\> |
209+
| `clearCachedAccessToken()` | (`tokenString`: `string`) => `Promise`\<`null`\> | `GoogleSignin.clearCachedAccessToken` |
210+
| `presentExplicitSignIn` | (`params?`: [`OneTapExplicitSignInParams`](#onetapexplicitsigninparams)) => `Promise`\<[`OneTapExplicitSignInResponse`](#onetapexplicitsigninresponse)\> |
211+
| `requestAuthorization` | (`options`: [`RequestAuthorizationParams`](#requestauthorizationparams)) => `Promise`\<[`AuthorizationResponse`](#authorizationresponse)\> |
212+
| `signOut` | () => `Promise`\<`null`\> |
213+
| `revokeAccess` | (`emailOrUniqueId`: `string`) => `Promise`\<`null`\> |
213214

214215
## Original Google sign in
215216

@@ -229,7 +230,7 @@ On the web, the signatures of `signIn`, `presentExplicitSignIn`, and `createAcco
229230

230231
> **ConfigureParams** = [`ClientIdOrPlistPath`](#clientidorplistpath) & \{ `accountName?`: `string`; `forceCodeForRefreshToken?`: `boolean`; `hostedDomain?`: `string`; `offlineAccess?`: `boolean`; `openIdRealm?`: `string`; `profileImageSize?`: `number`; `scopes?`: `string`[]; `webClientId?`: `WebClientId`; \}
231232
232-
#### Type declaration
233+
#### Type Declaration
233234

234235
| Name | Type | Description |
235236
| --------------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
@@ -338,7 +339,7 @@ The response object when the user signs in successfully.
338339
339340
The entry point of the Google Sign In API, exposed as `GoogleSignin`.
340341

341-
#### Type declaration
342+
#### Type Declaration
342343

343344
| Name | Type |
344345
| -------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
@@ -500,7 +501,7 @@ if (isSuccessResponse(response)) {
500501

501502
> **GoogleSigninButtonProps** = `ViewProps` & \{ `color?`: `"dark"` \| `"light"`; `disabled?`: `boolean`; `onPress?`: () => `void`; `size?`: `number`; \}
502503
503-
#### Type declaration
504+
#### Type Declaration
504505

505506
| Name | Type |
506507
| ------------ | --------------------- |
@@ -515,7 +516,7 @@ if (isSuccessResponse(response)) {
515516

516517
> **WebGoogleSignInButtonProps** = `Omit`\<`GsiButtonConfiguration`, `"logo_alignment"`\> & \{ `logoAlignment?`: `GsiButtonConfiguration`\[`"logo_alignment"`\]; `onError?`: (`error`: `Error`) => `void`; \}
517518
518-
#### Type declaration
519+
#### Type Declaration
519520

520521
| Name | Type |
521522
| ---------------- | ---------------------------------------------- |
@@ -585,7 +586,7 @@ You can specify a different bundle path for the config file, e.g. "GoogleService
585586

586587
Alternatively, set the client ID explicitly by providing `iosClientId`.
587588

588-
#### Type declaration
589+
#### Type Declaration
589590

590591
\{ `iosClientId?`: `string`; \}
591592

docs/migrating.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ Migrating from Original to Universal module is mostly about changing the method
2222
| `signOut` | `signOut` | |
2323
| `revokeAccess` | `revokeAccess` | Universal requires email/id parameter on web. |
2424
| `hasPreviousSignIn` | Use `signIn` response | Check for `noSavedCredentialFound` response type. |
25-
| `clearCachedAccessToken` | Not provided, presumably not needed. | - |
25+
| `clearCachedAccessToken` | `clearCachedAccessToken` | Same functionality. |
2626

2727
---
2828

29-
## Migrating to new JS API
29+
## Migrating to the new JS API
3030

3131
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.
3232

docs/one-tap.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,14 @@ import RequestAuthorization from './screenshots/_requestAuthorization.mdx';
277277

278278
<RequestAuthorization />
279279

280+
---
281+
282+
### `clearCachedAccessToken`
283+
284+
signature: (`accessTokenString`: `string`) => `Promise`\<`null`\>
285+
286+
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:)).
287+
280288
## Automatic `webClientId` & `iosClientId` detection {#automatic-config}
281289

282290
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.

0 commit comments

Comments
 (0)