diff --git a/docs/api/index.mdx b/docs/api/index.mdx index c8feeeb..3d80405 100644 --- a/docs/api/index.mdx +++ b/docs/api/index.mdx @@ -182,14 +182,15 @@ Learn more in the [guide](/docs/one-tap#requestauthorization). #### Properties -| Property | Type | Description | -| ---------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `accountName?` | `string` | Android only. Specifies an account on the device that should be used. | -| `hostedDomain?` | `string` | Android only. Specifies a hosted domain restriction. By setting this, authorization will be restricted to accounts of the user in the specified domain. | -| `offlineAccess?` | \{ `enabled`: `boolean`; `forceCodeForRefreshToken?`: `boolean`; \} | - | -| `offlineAccess.enabled` | `boolean` | Whether to enable offline access. If enabled, `serverAuthCode` will be returned in the response. | -| `offlineAccess.forceCodeForRefreshToken?` | `boolean` | Android only. If true, the granted code can be exchanged for an access token and a refresh token. Only use true if your server has suffered some failure and lost the user's refresh token. | -| `scopes` | `string`[] | The Google API scopes to request access to. See [scopes docs](/docs/integration-notes#additional-scopes). | +| Property | Type | Description | +| ---------------------------------------------------- | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `accountName?` | `string` | Android only. Specifies an account on the device that should be used. | +| `hostedDomain?` | `string` | Android only. Specifies a hosted domain restriction. By setting this, authorization will be restricted to accounts of the user in the specified domain. | +| `offlineAccess?` | \{ `enabled`: `boolean`; `forceCodeForRefreshToken?`: `boolean`; \} | - | +| `offlineAccess.enabled` | `boolean` | Whether to enable offline access. If enabled, `serverAuthCode` will be returned in the response. | +| `offlineAccess.forceCodeForRefreshToken?` | `boolean` | Android only. If true, the granted code can be exchanged for an access token and a refresh token. Only use true if your server has suffered some failure and lost the user's refresh token. **Deprecated** Use `prompt: 'consent'` instead. | +| `prompt?` | [`AuthorizationPrompt`](#authorizationprompt) \| [`AuthorizationPrompt`](#authorizationprompt)[] | Android only. Controls the prompt behavior for the authorization request. - `'select_account'`: Forces account selection (overrides `accountName`) modal to show. - `'consent'`: Forces the consent modal to show. Applies only to when `offlineAccess` is enabled. You may pass an array (`['consent', 'select_account']`) to show both modals. | +| `scopes` | `string`[] | The Google API scopes to request access to. See [scopes docs](/docs/integration-notes#additional-scopes). | --- @@ -364,7 +365,7 @@ The entry point of the Google Sign In API, exposed as `GoogleSignin`. ### statusCodes -> `const` **statusCodes**: `Readonly`\<\{ `IN_PROGRESS`: `string`; `NULL_PRESENTER`: `"NULL_PRESENTER"`; `ONE_TAP_START_FAILED`: `"ONE_TAP_START_FAILED"`; `PLAY_SERVICES_NOT_AVAILABLE`: `string`; \}\> +> `const` **statusCodes**: `Readonly`\<\{ `IN_PROGRESS`: `"IN_PROGRESS"`; `NULL_PRESENTER`: `"NULL_PRESENTER"`; `PLAY_SERVICES_NOT_AVAILABLE`: `"PLAY_SERVICES_NOT_AVAILABLE"`; \}\> Read more about the meaning of the error codes in the [guide](/docs/errors). @@ -595,7 +596,9 @@ 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 +#### Union Members + +##### Type Literal \{ `iosClientId?`: `string`; \} @@ -603,6 +606,10 @@ Alternatively, set the client ID explicitly by providing `iosClientId`. | -------------- | -------- | ------------------------------------------------------------------------------------------------------------------ | | `iosClientId?` | `string` | If you want to specify the client ID of type iOS. It is taken from the `GoogleService-Info.plist` file by default. | +--- + +##### Type Literal + \{ `googleServicePlistPath?`: `string`; \} | Name | Type | Description | diff --git a/docs/errors.md b/docs/errors.md index da137b2..2acf771 100644 --- a/docs/errors.md +++ b/docs/errors.md @@ -1,6 +1,6 @@ --- sidebar_position: 60 -description: 'Error handling guide. Covers `isErrorWithCode` helper, error codes (`SIGN_IN_CANCELLED`, `PLAY_SERVICES_NOT_AVAILABLE`, etc.), and best practices.' +description: 'Error handling guide. Covers `isErrorWithCode` helper, stable status codes, and best practices.' --- # Error handling @@ -37,7 +37,7 @@ try { import { statusCodes } from '@react-native-google-signin/google-signin'; ``` -Status codes are useful when determining which kind of error has occurred during the sign-in process. Under the hood, these constants are derived from native error codes and are platform-specific. Always compare `error.code` to `statusCodes.*` and do not rely on the raw value of `error.code`. +Status codes are useful when determining which kind of error has occurred during the sign-in process. These constants are stable canonical values exported by the library, so you can compare `error.code` to `statusCodes.*` with good TypeScript support. Less common native failures may still surface other string values. See [example usage](one-tap#signin).