Closed thianphat closed 1 year ago
Hello @thianphat It sounds like you're using expo.
I belive the right workaround is to download the Google services json file from firebase and use that.
Hope it helps 👍
Hello @thianphat It sounds like you're using expo.
I belive the right workaround is to download the Google services json file from firebase and use that.
Hope it helps 👍
Hi, so do I download the file from Firebase then replace it with my Google API info? Can you explain what parts of the file I should replace since I don't use Firebase.
just download and use that file, that's it. No replacements.
just download and use that file, that's it. No replacements.
Okay, thanks that seemed to work for building without any errors.
So, what I did was I created a Firebase project using the current Google API project as the basis following these instructions
However, the data returned back is undefined. For iOS I get the user data back, but on Android nothing is returned after logging into Google. It seems like the line const userInfo = await GoogleSignin.signIn();
is not working as intended. See video here.
My code is as so:
const signIn = async () => {
try {
await GoogleSignin.hasPlayServices();
console.log(GoogleSignin.hasPlayServices())
const userInfo = await GoogleSignin.signIn();
setUserInfo({ userInfo });
console.log("Google Auth Info", userInfo)
} catch (error) {
if (error.code === statusCodes.SIGN_IN_CANCELLED) {
// user cancelled the login flow
console.log(error)
} else if (error.code === statusCodes.IN_PROGRESS) {
// operation (e.g. sign in) is in progress already
console.log(error)
} else if (error.code === statusCodes.PLAY_SERVICES_NOT_AVAILABLE) {
// play services not available or outdated
console.log(error)
} else {
// some other error happened
}
}
};
This function also returns false for Android
const isSignedIn = async () => {
const isSignedIn = await GoogleSignin.isSignedIn();
console.log("Signed in?",isSignedIn, Device.osName)
};
Hello, it sounds pretty weird that you'd get undefined back.
But knowing that, it's not surprising that calling const isSignedIn = await GoogleSignin.isSignedIn();
returns false.
If you've added the json file from firebase and it's still not working, I advice you go over the setup docs here https://github.com/react-native-google-signin/google-signin/blob/master/docs/android-guide.md
If that does not help, you can get in touch with me via email and I can help you out, as a paid service.
Thank you! :)
Hello,
it sounds pretty weird that you'd get undefined back.
But knowing that, it's not surprising that calling
const isSignedIn = await GoogleSignin.isSignedIn();
returns false.If you've added the json file from firebase and it's still not working, I advice you go over the setup docs here https://github.com/react-native-google-signin/google-signin/blob/master/docs/android-guide.md
If that does not help, you can get in touch with me via email and I can help you out, as a paid service.
Thank you! :)
Thanks, I emailed you.
Do I need to make changes to the gradle files as shown in the instructions?
Hello and thanks for asking, closing this as we resolved the issue via personal communication.
Thank you 🙂
Hello! @vonovak can you show how resolved it?
I have the same problem! But in my case i use CLI With "react-native": "0.72.4",
Steps to Reproduce
npm run android
Just run
npm run android
Expected Behavior
I know it says NOT to use the google-services.json file if you aren't using Firebase, but I also run into another build error when the file is not included. Please see below.
Actual Behavior
WITH google-services.json
Does not build. I get this error:
The issue occurs when trying to build the android version of the app. I've already built the iOS app and tested it and it works. I have the google-services.json file in the root directory of my project. The containing json object is as follows:
I realize that the
project_info
object does not exist when downloading the json file from the Google API dashboard. I've read online that Firebase will provide thisproject_info
object, but I am not using Firebase for my DB. Is there a workaround for this? I've read through the documentation and could not find an answer. **WITHOUT google-services.json
per the troubleshooting docs: for non-firebase users it says to not include the google-services.json file nor make any changes to the gradle files but WITHOUT the google-services.json file in the root directory, i get this error:
✖ Config sync failed Error: [android.dangerous]: withAndroidDangerousBaseMod: Cannot copy google-services.json from /Users/***/***/google-services.json to /Users/***/***/android/app/google-services.json. Please make sure the source and destination paths exist.
Could someone please help? I've tried the recommended steps without Firebase and read through the documentation for hours on end and cannot find a solution.
Environment
Please provide
pod install
and cocoapods version (if applicable): N/Aplay-services-auth
and version of the Google Play Services app on your phone (if applicable): latest