Skip to content

Commit 7885d2e

Browse files
authored
docs: config debugger (#78)
1 parent cfd7b42 commit 7885d2e

File tree

4 files changed

+135
-36
lines changed

4 files changed

+135
-36
lines changed

docs/config-doctor.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
sidebar_label: Config doctor
3+
sidebar_position: 75
4+
sidebar_class_name: sponsor-heart
5+
---
6+
7+
# Configuration Doctor (beta)
8+
9+
A command-line tool designed to help with Android signing configuration issues and quickly resolve the infamous `DEVELOPER_ERROR`, or potentially [other errors](#when-to-use) too.
10+
11+
## Why
12+
13+
To save time. Developers sometimes waste hours or even days tracking down the [errors](#when-to-use).
14+
15+
This tool gives you the SHA-1 fingerprints that need to be added to your Google project configuration to resolve the error.
16+
17+
## Usage
18+
19+
The tool can extract SHA-1 fingerprints directly from a device/emulator with your app installed, or from an APK file.
20+
21+
Run the command as shown below and follow the instructions.
22+
23+
```bash
24+
# Usage with device/emulator
25+
npx @react-native-google-signin/config-doctor --package-name com.yourapp.name
26+
27+
# Usage with an APK file
28+
npx @react-native-google-signin/config-doctor --apk-path ./app-release.apk
29+
```
30+
31+
### Arguments
32+
33+
- `--package-name` (optional): Your Android app's package name. If provided, the tool extracts the APK from a connected device/emulator.
34+
- `--apk-path` (optional): Path to an APK file.
35+
36+
## When to use
37+
38+
When getting `DEVELOPER_ERROR`, unexpected [`cancelled`](https://issuetracker.google.com/issues/424210681) or even `GetCredentialProviderConfigurationException` during Sign-In. You can run into these errors:
39+
40+
- When setting up Google Sign-In for the first time
41+
- After downloading your app from Play Store
42+
- When switching between debug and release builds
43+
44+
### Example Output
45+
46+
```
47+
✔ Application package name: com.some.app.android
48+
49+
🔍 Found the following SHA-1 certificate fingerprints:
50+
51+
A1:B2:C3:D4:E5:F6:G7:H8:I9:J0:K1:L2:M3:N4:O5:P6:Q7:R8:S9:T0
52+
53+
Next steps:
54+
...
55+
```
56+
57+
## Requirements
58+
59+
- Valid subscription (get access at [universal-sign-in.com](https://universal-sign-in.com))
60+
- Android device/emulator with your app installed, OR a built APK file
61+
62+
## Related Documentation
63+
64+
- [Collecting configuration information](./setting-up/get-config-file.mdx)

docs/install.mdx

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,17 @@ Why paid? According to the [State of React Native Survey](https://results.2024.s
2020
- iOS & macOS: Powered by the [Google Sign-In SDK](https://developers.google.com/identity/sign-in/ios/start)
2121

2222
- **Licensed:** see [pricing](https://universal-sign-in.com/#pricing) and [license](https://universal-sign-in.com/license).
23-
- **Trusted**: A total of over 250k npm package downloads.
23+
- **Trusted**: A total of over 400k npm package downloads.
2424
- **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).
2525
- **See the UI**: [screenshots](screenshots) of the features.
26+
- **Widely compatible & stable:** Both old and [new architecture](https://reactnative.dev/architecture/landing-page) of React Native are supported. See version [compatibility table](#requirements) below.
2627

27-
🛡️ **Advanced [security features](/docs/security)**
28+
🔧 **Easier setup**:
29+
30+
- Android [Config Doctor](/docs/config-doctor) that might save you from pulling your hair out.
31+
- Automatic detection of [configuration parameters](one-tap#automatic-config) for faster integration.
2832

29-
🔧 **Easier setup** — Automatic detection of [configuration parameters](one-tap#automatic-config) for faster integration.
33+
🛡️ **Advanced [security features](/docs/security)**
3034

3135
[//]: # '🖥️ **Unified API** - Write code once, deploy everywhere.'
3236

@@ -36,7 +40,7 @@ Why paid? According to the [State of React Native Survey](https://results.2024.s
3640

3741
Available on the public npm registry, this version:
3842

39-
- Uses the functional, but deprecated [legacy Android Google Sign-In](https://web.archive.org/web/20240308064911/https://developers.google.com/identity/sign-in/android/start-integrating) which may be removed from the Google Play Services Auth SDK (`com.google.android.gms:play-services-auth`) at some point ([source](https://developer.android.com/identity/sign-in/legacy-gsi-migration)). The free package will continue to use a version where the deprecated but functional SDK is present.
43+
- Uses the functional, but deprecated [legacy Android Google Sign-In](https://web.archive.org/web/20240308064911/https://developers.google.com/identity/sign-in/android/start-integrating). The free package will continue to use a version where the deprecated but functional SDK is present.
4044
- Has platform support limited to Android and iOS.
4145
- Contains none of the extra features listed above.
4246

@@ -113,6 +117,11 @@ There are several guides to follow now:
113117

114118
For latest version of Universal Sign In, `compileSdkVersion` must be {'>='} 35 and `kotlinVersion` must be {'>='} 2.0.21 in your Android project. If you use Expo SDK 53 or newer, these requirements are already met. Use [`expo-build-properties`](https://docs.expo.dev/versions/latest/sdk/build-properties/#example-appjson-with-config-plugin) to specify these values on Expo SDK {'<='} 52.
115119

116-
The latest versions of the packages support the last three stable releases of React Native. Use older versions of the packages if you run older React Native.
120+
The latest version of the Universal Sign In package supports:
121+
122+
| | supported range |
123+
| ------------ | --------------- |
124+
| expo | 52.0.40 - 54 |
125+
| react-native | 0.76.0 - 0.81 |
117126

118-
[React Native new architecture](https://reactnative.dev/architecture/landing-page) is supported.
127+
Use older versions of the package if you run older React Native / Expo.

docs/setting-up/get-config-file.mdx

Lines changed: 41 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,55 +5,76 @@ sidebar_label: Configuration
55

66
# Collecting configuration information
77

8-
Before getting your hands dirty with code, some configuration needs to be taken care of. Be patient, this is the most complex part of the setup.
8+
Before getting your hands dirty with code, some configuration needs to be taken care of. Configuration information collected in this guide is used in later steps of the setup and in the `configure()` call: [1](/docs/one-tap#configure) or [2](/docs/original#configure).
99

10-
Configuration information collected in this guide is used in later steps of the setup and in the `configure()` call: [1](/docs/one-tap#configure) or [2](/docs/original#configure).
11-
12-
You **do not** need Firebase to configure Google Sign In. However, if you use it, it's a little easier to set up the sign in experience because Firebase gives you one file to download and put into your project.
10+
You **do not** need to use Firebase to configure Google Sign In.
1311

1412
## Android
1513

16-
Follow the 2 steps below to set up Google Sign In for your Android app.
14+
Follow the two steps below to set up Google Sign In for your Android app.
15+
16+
:::warning
17+
In case you encounter any of the following issues, revisit this guide - it means the steps below weren't fully completed.
18+
19+
- if you ever get the infamous `DEVELOPER_ERROR` error
20+
- if you can sign in with debug APK and not in release (or vice versa)
1721

18-
:::danger
19-
Completing this guide is crucial for Google Sign-In to work on Android. If not done correctly, you will get the infamous `DEVELOPER_ERROR` error [(how to troubleshoot it)](/docs/troubleshooting#developer_error).
2022
:::
2123

22-
### Step 1: Collect SHA-1 certificate fingerprints
24+
### Step 1: Collect SHA-1 (not SHA-256) certificate fingerprints
25+
26+
Your Android app probably uses multiple signing configurations. For example, an app might be signed differently when building `debug` and `release` APKs locally or when building on [Expo EAS](https://docs.expo.dev/app-signing/managed-credentials/#inspecting-credentials-configuration). Then there's the [Play App Signing](https://support.google.com/googleplay/android-developer/answer/9842756?hl=en) for store deployments — Google Play Store may _re-sign_ your app using one of its own signing configurations.
2327

24-
Your Android app probably uses multiple signing configurations. For example, an app might be signed differently when building `debug` and `release` APKs locally or when building on [Expo EAS](https://docs.expo.dev/app-signing/managed-credentials/#inspecting-credentials-configuration). Then there's the [Play App Signing](https://support.google.com/googleplay/android-developer/answer/9842756?hl=en) for store deployments — while the Google Play Store does not (re)build your app, it may _re-sign_ it using one of its own signing configurations.
28+
:::important
29+
If your app is not yet in the Play Store, focus only on the development APK and its SHA-1 certificate fingerprint. You can come back to this guide later when you upload your app to the Play Store.
2530

26-
It's extremely common for an app to have three or more signing configurations, each with its own SHA-1 certificate fingerprint.
31+
However, be advised that in the end, you need to get the SHA-1 certificate fingerprints for _all_ signing configurations and then use _all_ of those SHA-1 fingerprints in [Step 2](#step-2) below.
32+
:::
2733

28-
First, you need to **get the SHA-1 certificate fingerprints for all signing configurations** using the instructions below.
29-
Then, use _all_ of those SHA-1 fingerprints in [Step 2](#step-2) below.
34+
#### Collect SHA-1 certificate fingerprints from:
3035

3136
import Tabs from '@theme/Tabs';
3237
import TabItem from '@theme/TabItem';
3338

3439
<Tabs>
35-
<TabItem value="playStore" label="When releasing via Google Play Store">
40+
<TabItem value="config-doctor" label="A device or any APK file" default>
41+
42+
Use the [Configuration Doctor](../config-doctor.md). (Requires an [Universal sign in](/docs/install#sponsor-only-version) license.)
43+
44+
1. Get a device / emulator with the app installed, or get the APK (build it locally or in cloud, download from the Play Console / Play Store...)
45+
2. Run the tool and follow its instructions:
46+
47+
```bash
48+
npx @react-native-google-signin/config-doctor
49+
```
50+
51+
</TabItem>
52+
53+
<TabItem value="playStore" label="Google Play Store (when downloading from it)">
3654
Check if "Google Play App Signing" is enabled for your app [in the console](https://play.google.com/console/).
3755
If it is enabled, you need to take the following steps:
3856

3957
1. In Google Play Console, navigate to: \<Your App\> -> Release section (in the left sidebar) -> Setup -> App Signing.
40-
2. Under the "App signing key certificate" _and also_ "Upload key certificate", take note of `SHA-1 certificate fingerprint`. That's a total of two or more fingerprints (Play Store sometimes has more than one "App signing key certificate"!).
58+
2. Under the "App signing key certificate", take note of `SHA-1 certificate fingerprint`(s). Play Store sometimes has more than one "App signing key certificate"!
4159

4260
</TabItem>
4361

44-
<TabItem value="eas" label="When using Expo EAS">
62+
<TabItem value="eas" label="EAS Build">
4563
If you use [Expo EAS](https://expo.dev/eas), run `eas credentials` to obtain
4664
the Keystore information, which includes the SHA-1 fingerprint. See [EAS
4765
credentials
4866
docs](https://docs.expo.dev/app-signing/managed-credentials/#inspecting-credentials-configuration)
4967
to learn more.
5068
</TabItem>
5169

52-
<TabItem value="local" label="When developing locally">
53-
1. From your project root, `cd android && ./gradlew signingReport`.
54-
2. Scroll to the top of output, see the fingerprints. Debug fingerprint is used for locally-built debug apk,
55-
release fingerprint is used for release APK.
56-
</TabItem>
70+
<TabItem value="local" label="Local build">
71+
72+
1. From your project root, `cd android && ./gradlew signingReport`.
73+
2. Scroll to the top of output, see the fingerprints. Debug fingerprint is used for
74+
locally-built debug APK, release fingerprint is used for release APK.
75+
76+
</TabItem>
77+
5778
</Tabs>
5879

5980
<br />

docs/troubleshooting.md

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,31 @@ sidebar_position: 70
99

1010
### Login does not work when downloading from the Play Store.
1111

12-
See [the next paragraph](#developer_error).
12+
See [`DEVELOPER_ERROR` paragraph](#developer_error).
1313

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

16-
This is always (!_always_!) a configuration mismatch between your app and the server-side setup (in Firebase or Google Cloud console).
16+
This is always (! _absolutely always_ !) a configuration mismatch between your app and the server-side setup (in Firebase or Google Cloud console).
1717

18-
Follow these pointers:
18+
Firstly, if you are using Firebase Auth, verify Google is enabled as a Sign-in method in Firebase Console (Build -> Authentication -> Sign-in method).
1919

20-
- Follow the [setup guide](/docs/setting-up/get-config-file) and perform its steps once again.
21-
- Make sure that your SHA-1 (_NOT_ SHA-256!) certificate fingerprints and Android package name you entered in [Firebase Console](https://console.firebase.google.com/) / [Google Cloud Console](https://console.cloud.google.com/apis/credentials?project=_) are correct.
22-
- Add the SHA-1 from the output of [this command](https://x.com/vonovak/status/1692127631473529226) to your Firebase / Google Cloud Console. You should be able to recognize the SHA-1 — do not add a hash if you're not sure of its origin.
23-
- [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.
20+
Then: if you have the APK that gives this error, we recommend to run the [Configuration Doctor](./config-doctor.md) and follow its instructions:
21+
22+
```bash
23+
npx @react-native-google-signin/config-doctor
24+
```
25+
26+
Otherwise, we recommend:
27+
28+
- Follow the [setup guide](/docs/setting-up/get-config-file) and perform its steps once again, very carefully.
2429
- If you're passing `webClientId` in the 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".
25-
- If you are using Firebase, you need to add Google as a Sign-in method in Firebase itself (Build -> Authentication -> Sign-in method). If you have already created an app, you will be prompted for fingerprints and then you will get a new `google-services.json` which you need to use in your app instead of the old one.
30+
- [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.
2631

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

2934
If you get a `DEVELOPER_ERROR` when using Internal App Sharing, it is because Google resigns your application with its own key.
3035

31-
See [the previous paragraph](#developer_error).
36+
See [`DEVELOPER_ERROR` paragraph](#developer_error).
3237

3338
### "A non-recoverable sign in failure occurred"
3439

@@ -50,6 +55,6 @@ Along with "Your app is missing support for the following URL schemes" error in
5055

5156
Your `Url Schemes` configuration is incorrect.
5257

53-
If you use Expo, make sure that the [config plugin](setting-up/expo#add-config-plugin) is configured correctly.
58+
If you use Expo, verify that the [config plugin](setting-up/expo#add-config-plugin) is configured correctly.
5459

5560
In vanilla React Native projects, add URL type [like this](https://react-native-google-signin.github.io/docs/setting-up/ios#xcode-configuration).

0 commit comments

Comments
 (0)