Skip to content

Commit

Permalink
docs: rename Modern to Universal (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
vonovak authored Feb 8, 2025
1 parent 0469c22 commit 3f41b3b
Show file tree
Hide file tree
Showing 23 changed files with 212 additions and 237 deletions.
2 changes: 1 addition & 1 deletion docs/_oneTapModuleTable.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
> `const` **GoogleOneTapSignIn**: complex type, see below
The entry point of the Modern Sign In API, exposed as `GoogleOneTapSignIn`.
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).

Expand Down
4 changes: 4 additions & 0 deletions docs/_sponsorBanner.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
:::tip
The functionality covered in this page is available in the licensed
version. [You can get a license here](https://rngs-package.com/#pricing) ⭐️.
:::
12 changes: 6 additions & 6 deletions docs/api/index.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# API reference

## Modern sign in module
## Universal sign in module

### AuthorizationResponse

Expand Down Expand Up @@ -61,7 +61,7 @@ Parameters for enabling [App Check](/docs/security#appcheck). Provide `debugProv
| `openIdRealm`? | `string` | iOS only. The OpenID2 realm of the home web server. This allows Google to include the user's OpenID Identifier in the OpenID Connect ID token. |
| `profileImageSize`? | `number` | iOS only. The desired height and width of the profile image. **Default** `120px` |
| `scopes`? | `string`[] | iOS only. The Google API scopes to request access to. Use `requestAuthorization` to request additional scopes on Android. **Default** `["email", "profile"]` |
| `webClientId` | `WebClientId` | The web client ID obtained from Google Cloud console. In the Modern module only, pass `autoDetect` to automatically determine the value from Firebase config file. |
| `webClientId` | `WebClientId` | The web client ID obtained from Google Cloud console. In the Universal module only, pass `autoDetect` to automatically determine the value from Firebase config file. |

---

Expand Down Expand Up @@ -194,7 +194,7 @@ Learn more in the [guide](/docs/one-tap#requestauthorization).

> `const` **GoogleOneTapSignIn**: complex type, see below
The entry point of the Modern Sign In API, exposed as `GoogleOneTapSignIn`.
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).

Expand Down Expand Up @@ -278,7 +278,7 @@ On the web, the signatures of `signIn`, `presentExplicitSignIn`, and `createAcco
| Name | Type | Description |
| ------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `loginHint`? | `string` | iOS only. The user's ID, or email address, to be prefilled in the authentication UI if possible. [See docs here](https://developers.google.com/identity/sign-in/ios/reference/Classes/GIDSignIn#-signinwithpresentingviewcontroller:hint:completion:). |
| `nonce`? | `string` | iOS only. A cryptographically random value used to mitigate replay attacks. Only available in the paid version. For support across all platforms, use the Modern sign in module. |
| `nonce`? | `string` | iOS only. A cryptographically random value used to mitigate replay attacks. Only available in the paid version. For support across all platforms, use the Universal sign in module. |

---

Expand Down Expand Up @@ -592,13 +592,13 @@ The response to calling One Tap's `signIn` and Original Google Sign In's `signIn
| `data` | `null` |
| `type` | `"noSavedCredentialFound"` |

## Web Modern sign in module
## Web Universal sign in module

### WebOneTapSignInCallbacks

> **WebOneTapSignInCallbacks**: \{`momentListener`: `MomentListener`;`onError`: (`error`: `NativeModuleError`) => `void` \| `Promise`\<`void`\>;`onResponse`: (`userInfo`: [`OneTapExplicitSignInResponse`](index.mdx#onetapexplicitsigninresponse)) => `void` \| `Promise`\<`void`\>; \}
When using Modern sign in on the web, the sign in result is delivered via a callback, not via a promise.
When using Universal sign in on the web, the sign in result is delivered via a callback, not via a promise.
The shape of data delivered to the callback is the same as the shape of the data in the promise, enabling code reuse.
Read more in the [guide](/docs/one-tap#web-support).

Expand Down
8 changes: 4 additions & 4 deletions docs/buttons/web.md → docs/buttons/web.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
This is the sign-in button that you can use in web apps. It renders `null` when used in native apps.
It has a slightly different API than the native `GoogleSigninButton` component which is why it exists as a separate component.

:::tip
Web support is only available in the paid version. [It takes just a few clicks to get access](/docs/install.mdx#obtaining-access) ❤️.
:::
import Banner from '../_sponsorBanner.mdx';

<Banner />

The button will _not render_ before the [Google Client API has been loaded](../setting-up/web). You can use the `onError` prop to detect this case.

### How to use this

As the Modern Sign In Guide explains, there are two ways to sign in on the web: using the One-tap UI or using the Google Sign-In button.
As the Universal sign in Guide explains, there are two ways to sign in on the web: using the One-tap UI or using the Google Sign-In button.

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

Expand Down
8 changes: 4 additions & 4 deletions docs/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ See [example usage](original#signin).
| `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. |
| `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). |

### Status codes specific to Modern sign in {#modern-status-codes}
### Status codes specific to Universal sign in {#universal-status-codes}

| Name | Description |
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ONE_TAP_START_FAILED` | Thrown only on Android when the Modern sign in UI cannot be presented. This happens during the [cooldown period](https://developers.google.com/identity/gsi/web/guides/features#exponential_cooldown). You can still call `presentExplicitSignIn` in that case. |
| Name | Description |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `ONE_TAP_START_FAILED` | Thrown only on Android when the Universal sign in UI cannot be presented. This happens during the [cooldown period](https://developers.google.com/identity/gsi/web/guides/features#exponential_cooldown). You can still call `presentExplicitSignIn` in that case. |

See [example usage](one-tap#signin).
53 changes: 29 additions & 24 deletions docs/install.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,47 +8,52 @@ There are two ways to consume the package:

[//]: # '🌟'

### Modern version {#sponsor-only-version}
### Universal Sign In {#sponsor-only-version}

Available through purchasing a license, and to Expo customers, this version includes:
⭐️ **Key Features**:

⚡️[**Modern Sign In**](/docs/one-tap) implemented with:
- **Cross-Platform**: Unified API which works on **Android**, **iOS**, **Web**, and **macOS**.

- Android: latest [Credential Manager library](https://developers.google.com/identity/android-credential-manager)
- Web: [Sign In with Google for Web](https://developers.google.com/identity/gsi/web/guides/features)
- iOS & macOS: [Google Sign-In SDK](https://developers.google.com/identity/sign-in/ios/start)
- Android: Built with [Credential Manager library](https://developers.google.com/identity/android-credential-manager)
- Web: Uses [Sign In with Google for Web](https://developers.google.com/identity/gsi/web/guides/features)
- iOS & macOS: Powered by the [Google Sign-In SDK](https://developers.google.com/identity/sign-in/ios/start)

- **Licensed:** see [pricing](https://rngs-package.com/#pricing) and [license](https://rngs-package.com/license).
- **Trusted**: Over 130k npm package downloads.
- **See the UI**: [screenshots](screenshots) of the features.
- **Faster Sign-Ups**: Reduce sign-up and sign-in times on Android by up to 50%, according to [Google](https://developer.android.com/identity/sign-in/legacy-gsi-migration#authentication).

🛡️ **Advanced [security features](/docs/security)**

🔧 **Easier configuration** - [some parameters can be detected automatically](one-tap#automatic-config)
🔧 **Easier setup** - Automatic detection of [configuration parameters](one-tap#automatic-config) for faster integration.

🖥️ **Full platform support** - Deploy everywhere with a unified api: Android, iOS, Web, and macOS
[//]: # '🖥️ **Unified API** - Write code once, deploy everywhere.'

**An example app** - to showcase all **Modern Sign In** features
📱 **An example app** - to showcase all Universal sign in features

Your support helps improve the module and upstream SDKs (such as [1](https://github.com/openid/AppAuth-iOS/pull/788), [2](https://github.com/google/GoogleSignIn-iOS/pull/402)).
Your purchase enables improvements in the module and upstream SDKs (such as [1](https://github.com/openid/AppAuth-iOS/pull/788), [2](https://github.com/google/GoogleSignIn-iOS/pull/402)).

### Public version

Available on the public npm registry, this version:

- Has platform support limited to Android and iOS.
- Uses functional, but deprecated [Legacy Android Google Sign-In](https://web.archive.org/web/20240308064911/https://developers.google.com/identity/sign-in/android/start-integrating).
- Uses functional, but deprecated [legacy Android Google Sign-In](https://web.archive.org/web/20240308064911/https://developers.google.com/identity/sign-in/android/start-integrating).
- Contains none of the extra features listed above.

## Obtaining access to the Modern version {#obtaining-access}
## Obtaining Universal Sign In {#obtaining-access}

[Upon purchasing a license](https://rngs-package.com/), you will be able to configure your (or your colleagues') access to the private npm package and to the private repo with the sources and examples. Alternatively, as an Expo customer, obtain access through [this form](https://forms.gle/tpP7TfUGW1CwgaEZ8).
Universal sign in requires [purchasing a license](https://rngs-package.com/#pricing), after which you will be able to configure your (or your colleagues') access to the private npm package and to the private repo with the sources and examples. Alternatively, as an Expo customer, obtain access through this [form](https://forms.gle/tpP7TfUGW1CwgaEZ8).

[//]: # 'Note that this version is distributed under a [custom license](license).'

Three steps are needed to access the private package, which is hosted on [GitHub npm packages registry](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry).
## Accessing the private npm package {#package-manager-setup}

1. [Purchase a license](https://rngs-package.com/) to immediately set up access. Alternatively, [complete the form](https://forms.gle/tpP7TfUGW1CwgaEZ8).
The private npm package is like any other, but it's hosted on the [GitHub npm packages registry](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry), not the public npm registry. Therefore, a small bit of setup is needed:

2. [Obtain here](https://github.com/settings/tokens/new?description=react-native-google-sign-in&scopes=read:packages) a Personal Access Token with `packages:read` permission.
1. [Obtain here](https://github.com/settings/tokens/new?description=react-native-google-sign-in&scopes=read:packages) a Personal Access Token with `packages:read` permission.

3. Set up your package manager so that it fetches the package from the GH packages registry instead of the public registry. In this example, we're using an `NPM_TOKEN_GOOGLE_SIGN_IN` environment variable.
2. Set up your package manager so that it fetches the package from the GH packages registry instead of the public registry. In this example, we're using an `NPM_TOKEN_GOOGLE_SIGN_IN` environment variable.

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
Expand Down Expand Up @@ -82,12 +87,6 @@ import TabItem from '@theme/TabItem';

If you use another package manager ([such as Bun](https://bun.sh/docs/install/registries)), refer to its documentation on how to set up a custom registry.

## Requirements

The packages support last 3 stable releases of React Native. Unofficially, they may work with older versions too.

If you're using the [New Architecture](https://reactnative.dev/docs/new-architecture-intro), it's strongly recommended to use the latest React Native version available.

## Installing

<Tabs queryString="package-manager">
Expand All @@ -107,10 +106,16 @@ If you're using the [New Architecture](https://reactnative.dev/docs/new-architec

</Tabs>

If you're using the Modern version, open the lockfile (`yarn.lock` / `package-lock.json`...) and verify that the package is fetched from the GitHub registry (the entry must point to `npm.pkg.github.com`, not `registry.npmjs.org`). If it does not, it means that your package manager is not configured correctly - try uninstalling and reinstalling the package.
If you're using the Universal version, open the lockfile (`yarn.lock` / `package-lock.json`...) and verify that the package is fetched from the GitHub registry (the entry must point to `npm.pkg.github.com`, not `registry.npmjs.org`). If it does not, it means that your package manager is not configured correctly - try uninstalling and reinstalling the package.

There are several guides to follow now:

- [Expo guide](setting-up/expo) for native mobile apps built with Expo
- [Web guide](setting-up/web) if you want to use the package on web
- If you're not using Expo but plain React Native, follow [Android guide](setting-up/android) and [iOS guide](setting-up/ios)

## Requirements

The packages support last 3 stable releases of React Native. Unofficially, they may work with older versions too.

If you're using the [New Architecture](https://reactnative.dev/docs/new-architecture-intro), it's strongly recommended to use the latest React Native version available.
2 changes: 1 addition & 1 deletion docs/license.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ sidebar_position: 80
sidebar_label: License
---

The original module is licensed as MIT, the Modern Sign In module has [this license](https://rngs-package.com/license).
The original module is licensed as MIT, the Universal sign in module has [this license](https://rngs-package.com/license).

Please do get in touch if you have any questions or concerns about the license!
2 changes: 1 addition & 1 deletion docs/migrating.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ sidebar_label: Migrating

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.

## Modern sign in module
## Universal Sign In

1. Add the [`configure`](one-tap#configure) method to your code. This method is required to be called to configure the module.

Expand Down
Loading

0 comments on commit 3f41b3b

Please sign in to comment.