Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: better developer error docs #22

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/setting-up/expo.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ If you're _not_ using Firebase, provide the `iosUrlScheme` option to the config

To obtain `iosUrlScheme`, go to the [Google Cloud Console](https://console.cloud.google.com/apis/credentials) and copy the "iOS URL scheme" from your iOS client in the "OAuth 2.0 Client IDs" section.

```json title="app.json"
```json title="app.json|js"
{
"expo": {
"plugins": [
Expand All @@ -53,7 +53,7 @@ To obtain `iosUrlScheme`, go to the [Google Cloud Console](https://console.cloud

If you are using Firebase, [obtain the config file](./get-config-file) and place it into your project. Then specify the path to the file:

```json title="app.json"
```json title="app.json|js"
{
"expo": {
"plugins": ["@react-native-google-signin/google-signin"],
Expand Down
32 changes: 17 additions & 15 deletions docs/setting-up/get-config-file.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Please note that you **do not** need Firebase to configure Google Sign In. Howev

Read below on how to set up Google Sign In for your Android app.

### Obtaining SHA-1 certificate fingerprints
### Obtain SHA-1 certificate fingerprints

:::warning
This is crucial for Google Sign-In to work on Android. If not done correctly, you will get the infamous [`DEVELOPER_ERROR` error](/docs/troubleshooting#developer_error).
Expand All @@ -26,10 +26,9 @@ import TabItem from '@theme/TabItem';
<TabItem value="eas" label="When using Expo EAS">
If you're using Expo EAS, read [credentials docs](https://docs.expo.dev/app-signing/managed-credentials/#inspecting-credentials-configuration) to learn how to obtain information about how your app is signed with EAS.
</TabItem>

<TabItem value="local" label="When developing locally">
1. From your project root, `cd android && ./gradlew signingReport`. 2. Scroll
to the top of output, see the fingerprints. Debug fingerprint is used in dev,
1. From your project root, `cd android && ./gradlew signingReport`.
2. Scroll to the top of output, see the fingerprints. Debug fingerprint is used in dev,
release fingerprint is used for release APK.
</TabItem>

Expand All @@ -46,13 +45,14 @@ import TabItem from '@theme/TabItem';

<Tabs>
<TabItem value="firebase" label="When using Firebase">
1. Sign in to Firebase and open your project.
2. Click the Settings icon and select Project settings.
3. In the "Your apps" card, select the app you need to add SHA1 to.
4. Click "Add fingerprint".
4. Download the `google-services.json` file.
1. Sign in to Firebase and open your project.
2. Click the Settings icon and select Project settings.
3. In the "Your apps" card, select the app you need to add SHA1 to.
4. Click "Add fingerprint".
5. Check that "Package name" is correct.
6. Download the `google-services.json` file.

![Firebase, add Android keystore's SHA1 to your project](/img/android-fingerprint-firebase.png)
![Firebase, add Android keystore's SHA1 to your project](/img/android-fingerprint-firebase.png)

</TabItem>

Expand All @@ -69,9 +69,11 @@ Read below on how to set up Google Sign In for your iOS app.

<Tabs>
<TabItem value="firebase" label="When using Firebase">
1. Sign in to Firebase and open your project.
2. Click the Settings icon and select Project settings.
3. Download the `GoogleService-Info.plist` file.
1. Sign in to Firebase and open your project.
2. Click the Settings icon and select Project settings.
3. In the "Your apps" card, select the app.
4. Check that "Bundle ID" is correct.
5. Download the `GoogleService-Info.plist` file.

</TabItem>

Expand All @@ -81,8 +83,8 @@ Read below on how to set up Google Sign In for your iOS app.

Follow the instructions at ["Get an OAuth client ID"](https://developers.google.com/identity/sign-in/ios/start-integrating#get_an_oauth_client_id), ["Get an OAuth server client ID"](https://developers.google.com/identity/sign-in/ios/start-integrating#server_client_id) and then ["Configure your application project"](https://developers.google.com/identity/sign-in/ios/start-integrating#configure_app_project).

When done configuring your project, take note of Web Client ID which you may need later. It can be found [here](https://console.developers.google.com/apis/credentials).
Make sure you select the correct project. The Client IDs are under OAuth section.
When done configuring your project (check you selected the correct project in the console), take note of Web Client ID which you may need later. It can be found [here](https://console.developers.google.com/apis/credentials).
The Client IDs are under the OAuth section.

</TabItem>

Expand Down
10 changes: 7 additions & 3 deletions docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@ See [the next paragraph](#developer_error).

### `DEVELOPER_ERROR` or `code: 10` or `Developer console is not set up correctly` error message {#developer_error}

This is always (_always_!) a configuration mismatch. Make sure that your SHA certificate fingerprints and package name you entered in Firebase / Google Cloud Console are correct. If you are in development, make sure your development signing fingerprint is added as well.
This is always (_always_!) a configuration mismatch between your app and Google's servers. The problem is on your app's side.

Follow the [setup guide](/docs/setting-up/get-config-file) and perform its steps once again.
Follow these pointers:

If you're passing `webClientId` in configuration object to `GoogleSignin.configure()` make sure it's correct and that it is of type web (NOT Android!). You can get your `webClientId` from [Google Developer Console](https://console.developers.google.com/apis/credentials). It is listed under "OAuth 2.0 client IDs".
- [Search the issue tracker](https://github.com/react-native-google-signin/google-signin/issues?q=is%3Aissue+DEVELOPER+ERROR+is%3Aclosed) for old reports of the error
- Make sure that your SHA certificate fingerprints and package name you entered in Firebase / Google Cloud Console are correct. If you are in development, make sure your development signing fingerprint is added as well.
- Make sure you filled out "OAuth Consent Screen" in Google Cloud Console.
- Follow the [setup guide](/docs/setting-up/get-config-file) and perform its steps once again.
- If you're passing `webClientId` in configuration object to `GoogleSignin.configure()` make sure it's correct and that it is of type web (NOT Android!). You can get your `webClientId` from [Google Developer Console](https://console.developers.google.com/apis/credentials). It is listed under "OAuth 2.0 client IDs".

### Login does not work when using Internal App Sharing.

Expand Down