google-signin: Sign in returns "CANCELED" on android and "Audience is not a valid client ID" on iOS
After following the installation guide for both platforms we managed to run the framework on both platforms without a compile issue. However when we actually try to use the google button both platforms return an error instead of user_info
On iOS the error is:
Message Error: RNGoogleSignInError: Unknown error when signing in., Error Domain=com.google.HTTPStatus Code=400 "(null)" UserInfo={data_content_type=application/json; charset=utf-8, json={ error = "invalid_audience"; "error_description" = "Audience is not a valid client ID."; }, data=<7b0a2020 22657272 6f72223a 2022696e 76616c69 645f6175 6469656e 6365222c 0a202022 6572726f 725f6465 73637269 7074696f 6e223a20 22417564 69656e63 65206973 206e6f74 20612076 616c6964 20636c69 656e7420 49442e22 0a7d>} at createErrorFromErrorData (NativeModules.js:146) at NativeModules.js:95 at MessageQueue.__invokeCallback (MessageQueue.js:397) at MessageQueue.js:127 at MessageQueue.__guard (MessageQueue.js:297) at MessageQueue.invokeCallbackAndReturnFlushedQueue (MessageQueue.js:126) at debuggerWorker.js:72
On Android the error is
Message', { [Error: CANCELED]\ ReactNativeJS: framesToPop: 1, ReactNativeJS: nativeStackAndroid: [], ReactNativeJS: userInfo: null, ReactNativeJS: code: '16', ReactNativeJS: line: 21878, ReactNativeJS: column: 31, ReactNativeJS: sourceURL: 'http://10.0.2.2:8081/index.delta?platform=android&dev=true&minify=false
Tried solutions
From all the other issues and forums we checked everything we could and made sure that the WebClientID is correct in the google-services.json file (and .plist file on iOS) and on firebase. Also generated SHA-1 fingerprints for both debug and release versions and added to firebase. But these solutions did not work.
React Versions:
- “react”: “16.6.3”,
- “react-native”: “0.58.0”,
- “react-native-google-signin”: “^1.0.2”
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 7
- Comments: 21 (4 by maintainers)
@fabriziobertoglio1987 Thanks man, for me worked that I got webClientId directly from Firebase 👌
For me adding the correct webClientId does not resolve the issue. Everything works fine on iOS. On Android it just throws “canceled”.
Edit: For me it was the signing keys. Follow the instructions here to get your signing keys
https://developers.google.com/android/guides/client-auth
Then add BOTH of them to the settings page of your firebase project.
Managed to solve this by correcting webClientId in config.js.
Having the Android version of this issue where GoogleSignin.signIn() returns undefined, IOS is working fine
I am having a similar issue
I was using the wrong
webClientIdinside theconfig.jsfile as explained in the example page readmeThe page does not really include detailed explanation on how to configure
firebaseand thegoogle cloud console.Firebase should automatically create a new google cloud project, which will include the required api and oauth keys.
The
webClientIdshould be the one underOauth 2.0andWeb Client, not the android or ios keys.I was not able to find the project inside my google cloud platform, i suggest you to research online for the Google Cloud platform specific instruction on how to manage your projects and access those automatically generated
Here a post which explains more details of the configurations how to configure it.
I’m having the same issue on iOS (I haven’t tried it on Android yet):
My configuration:
Is that correct? How did you solve it?
EDIT I got it to work… webClientId should be the id like *.apps.googleusercontent.com. My bad