You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/buttons/web.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ As the Universal sign in Guide explains, there are two ways to sign in on the we
19
19
20
20
One-tap UI may not always be available: This happens if user has [opted out](https://developers.google.com/identity/gsi/web/guides/features#globally_opt_out) or when they close the dialog several times in a row, entering the [cooldown period](https://developers.google.com/identity/gsi/web/guides/features#exponential_cooldown).
21
21
22
-
The Google Sign-In button serves as a fallback. Tapping it will open the regular Google Sign-In dialog.
22
+
The Google Sign-In button serves as a fallback. Tapping it opens the regular Google Sign-In dialog.
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 GoogleSignIn error codes and are platform-specific. Always compare `error.code` to `statusCodes.*` and do not rely on the raw value of `error.code`.
39
+
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`.
|`IN_PROGRESS`| Trying to invoke another operation (e.g. `signInSilently`) when previous one has not yet finished. If you call e.g. `signInSilently` twice, two calls to `signInSilently` in the native module will be done. The promise from the first call to `signInSilently` will be rejected with this error, and the second will resolve / reject with the result of the native call. |
46
-
|`PLAY_SERVICES_NOT_AVAILABLE`| Play services are not available or outdated. This happens on Android, or on the web when you're calling the exposed APIs [before the Client library is loaded](setting-up/web). |
|`IN_PROGRESS`| Trying to invoke another operation (e.g. `signInSilently`) when previous one has not yet finished. If you call e.g. `signInSilently` twice, two calls to `signInSilently` in the native module are done. The promise from the first call to `signInSilently` will be rejected with this error, and the second will resolve / reject with the result of the native call. |
46
+
|`PLAY_SERVICES_NOT_AVAILABLE`| Play services are not available or outdated. This happens on Android, or on the web when you're calling the exposed APIs [before the Client library is loaded](setting-up/web). |
47
47
48
48
### Status codes specific to Universal sign in {#universal-status-codes}
Copy file name to clipboardExpand all lines: docs/integration-notes.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
sidebar_position: 55
2
+
sidebar_position: 61
3
3
---
4
4
5
5
# Integration notes
@@ -18,6 +18,7 @@ sidebar_position: 55
18
18
19
19
The default requested scopes are `email` and `profile`.
20
20
21
-
If you want to manage other data from your application (for example access user agenda or upload a file to drive) you need to request additional permissions. This can be accomplished by adding the necessary scopes when configuring the GoogleSignin instance.
21
+
If you want to manage other data from your application (for example, access user agenda or upload a file to drive) you need to request additional permissions. This can be accomplished by calling [`requestAuthorization`](one-tap#requestauthorization) or by
22
+
adding the necessary scopes when calling [`configure`](one-tap#configure).
22
23
23
24
Visit https://developers.google.com/identity/protocols/googlescopes or https://developers.google.com/oauthplayground/ for a list of available scopes.
Copy file name to clipboardExpand all lines: docs/one-tap.mdx
+19-45Lines changed: 19 additions & 45 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ sidebar_label: Universal Google sign in
4
4
sidebar_class_name: sponsor-heart
5
5
---
6
6
7
-
# Universal Google sign in
7
+
# Universal sign in
8
8
9
9
This is Google's recommended way to implement Google Sign In. This API is available on Android, iOS, macOS and web (with a little extra work [described below](#web-support)). It is a replacement for the [Original Google sign in](original). The module APIs are named `GoogleOneTapSignIn` for historical reasons.
It is mandatory to call `configure` before attempting to call any of the sign-in methods. This method is synchronous, meaning you can call e.g. `signIn` right after it. Typically, you would call `configure` only once, soon after your app starts.
73
73
74
-
`webClientId` is a required parameter. Use "autoDetect" for [automatic webClientId detection](#automatic-config).
74
+
`webClientId` is a required parameter. Use `"autoDetect"` for [automatic webClientId detection](#automatic-config).
75
75
76
76
If you're using neither Expo nor Firebase, you also need to provide the `iosClientId` parameter. All other parameters are optional.
| Apple | Attempts to restore a previous user sign-in without interaction. [Docs](https://developers.google.com/identity/sign-in/ios/reference/Classes/GIDSignIn#-restoreprevioussigninwithcompletion:). |
94
94
| Web | Attempts to sign in user automatically, without interaction. [Docs](https://developers.google.com/identity/gsi/web/reference/js-reference#auto_select). If none is found, presents a sign-in UI. [Read below](#web-support) for web support. |
95
95
96
-
Returns a `Promise` that resolves with [`OneTapResponse`](api#onetapresponse) or rejects in case of error.
97
-
98
-
If there is no user that was previously signed in, the promise resolves with [`NoSavedCredentialFound`](api#nosavedcredentialfound) object. In that case, you can call [`createAccount`](one-tap#createaccount) to start a flow to create a new account. You don't need to call `signIn` as a response to a user action - you can call it when your app starts or when suitable.
96
+
If there is no user that was previously signed in, the returned promise resolves with [`NoSavedCredentialFound`](api#nosavedcredentialfound) object. In that case, you can call [`createAccount`](one-tap#createaccount) to start a flow to create a new account. You don't need to call `signIn` as a response to a user action - you can call it when your app starts or when suitable.
| Android | Presents the sign in dialog explicitly. This is useful when the user has hit rate limiting ([`ONE_TAP_START_FAILED`](errors#universal-status-codes)) and the one-tap flow is thus not available, or if both `signIn` and `createAccount` resolve with [`NoSavedCredentialFound`](api#nosavedcredentialfound) object - which happens (in the unlikely case) when no Google account is present on the device. This will prompt the user to add a Google account. |
196
-
| Apple | Starts an interactive sign-in flow. Same as `createAccount`. |
197
-
| Web | Presents a one-tap prompt. Same as `createAccount`. |
| Android | Presents the sign in dialog explicitly. This is useful when the user has hit rate limiting ([`ONE_TAP_START_FAILED`](errors#universal-status-codes)) and the one-tap flow is thus not available, or if both `signIn` and `createAccount` resolve with [`NoSavedCredentialFound`](api#nosavedcredentialfound) object - which happens (in the unlikely case) when no Google account is present on the device. This prompts the user to add a Google account. |
188
+
| Apple | Starts an interactive sign-in flow. Same as `createAccount`. |
189
+
| Web | Presents a one-tap prompt. Same as `createAccount`. |
198
190
199
-
Preferably, call this method only as a reaction to when user taps a "sign in with Google" button.
191
+
Preferably, call this method only as a reaction to when user taps a [sign in button](buttons/google-logo-button).
The behavior of `checkPlayServices` varies across platforms:
220
208
221
209
- Android: The function resolves if the device has Play Services installed and their version is >= the minimum required version. Otherwise, it rejects with `statusCodes.PLAY_SERVICES_NOT_AVAILABLE` error code, and more information in `userInfo` field (see [below](#example-code-snippet)).
222
210
223
-
On Android, the presence of up-to-date Google Play Services is required to call any of the provided authentication and authorization methods. It is therefore necessary to call `checkPlayServices` any time prior to calling the authentication / authorization methods and only call those if `checkPlayServices` is successful.
224
-
225
211
The `showErrorResolutionDialog` parameter (default `true`) controls whether a dialog that helps to resolve an error is shown (only in case the error is user-resolvable).
226
212
227
-
Some errors are user-resolvable (e.g. when Play Services are outdated, or disabled) while other errors cannot be resolved (e.g. when the phone doesn't ship Play Services at all - which is the case with some device vendors).
213
+
On Android, the presence of up-to-date Google Play Services is required to call any of the provided authentication and authorization methods. It is therefore necessary to call `checkPlayServices` any time prior to calling the authentication / authorization methods and only call those if `checkPlayServices` is successful.
214
+
215
+
Some errors are user-resolvable (e.g. when Play Services are outdated or disabled) while other errors cannot be resolved (e.g. when the phone doesn't ship Play Services at all - which is the case with some device vendors).
228
216
229
217
<details>
230
218
<summary>Dialog screenshots</summary>
@@ -234,19 +222,11 @@ Some errors are user-resolvable (e.g. when Play Services are outdated, or disabl
234
222
235
223
</details>
236
224
237
-
- Apple: Play Services are an Android-only concept and are not needed on Apple. Hence, the method always resolves with:
238
-
239
-
```ts
240
-
{
241
-
minRequiredVersion: -1,
242
-
installedVersion: -1,
243
-
}
244
-
```
245
-
246
-
- Web: resolves (with the same value as on Apple) when the Google Client Library [is loaded](setting-up/web), rejects otherwise.
225
+
- Apple: Play Services are an Android-only concept and are not needed on Apple. Hence, the method always resolves.
226
+
- Web: resolves when the Google Client Library [is loaded](setting-up/web), rejects otherwise.
247
227
248
-
```ts title="Example of showPlayServicesUpdateDialog() method"
Revokes access given to the current application and signs the user out. Use when user deletes their account in your app. On the web, you need to provide the `id` or email of the user. On Android and Apple, the `emailOrUniqueId` parameter does not have any effect.
252
+
Revokes access given to the current application and signs the user out. Use when a user deletes their account in your app. On the web, you need to provide the `id` or email of the user. On Android and Apple, the `emailOrUniqueId` parameter does not have any effect.
273
253
274
254
Returns a `Promise` that resolves with `null` or rejects in case of error.
The underlying Android SDK separates authentication and authorization - that means that on Android you can request an access token and call Google APIs on behalf of the user without previously signing the user in.
@@ -295,16 +273,12 @@ This method is used to request extra authorization from the user. Use this on An
295
273
| Apple | Calls [`addScopes`](./original.mdx#addscopes). The resulting `accessToken` has access to the requested scopes. Use this if you want to read more user metadata than just the basic info. |
296
274
| Web | Not implemented at the moment. |
297
275
298
-
> There are minor differences between the Android and Apple implementations stemming from the underlying Google SDKs. For example, Apple returns all granted scopes, while Android may only return the scopes that were requested.
✨since v15.2.0 for `webClientId`, 18.2.0 for `iosClientId`
307
-
308
282
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.
309
283
310
284
Additionally, this module can automatically detect the `webClientId` from Firebase's configuration file (does not work on web where you need to provide it explicitly).
0 commit comments