Closed tahamaddam closed 7 months ago
Google sign in docs has this line:
❗️ Important: you need go through configuration steps for each platform as described on the README.
It's not entirely clear from the provided steps if this was done.
but then shows the "unknown error occurred" without app being crashed
this is most likely related to the missing SHA fingerpring of the android emulator.
You can get your SHA fingerprint by running ./gradlew signingReport
from android
folder.
You can add it on your firebase console:
but then shows the "unknown error occurred" without app being crashed
this is most likely related to the missing SHA fingerpring of the android emulator.
You can get your SHA fingerprint by running
./gradlew signingReport
fromandroid
folder. You can add it on your firebase console:
- Project overview > Cog icon
- Project settings
- Scroll down > SHA certificate fingerprints > Add fingerprint
Thanks, I didn't mention it above but I did create the keystore and added its SHA-1 fingerprint to Android app under Firebase settings.
I followed the steps outlined in this official Firebase codelab that uses firebase_ui_auth
package. You can see the configuration related to Google Sign-in at step 7. Only two differences in my implementation:
DefaultFirebaseOptions.currentPlatform.appId
to declare the clientId
Hi @tahamaddam, did you add the CFBundleURLTypes
to your Info.plist
?
Did you download the new GoogleService-Info.plist
file from the firebase console? If that is the case, that is the file you have to add not the one that is already in your project.
Can you also try re-running flutterfire configure
to see if you do get the new GoogleService-Info.plist
file?
Hi @tahamaddam, did you add the
CFBundleURLTypes
to yourInfo.plist
?Did you download the new
GoogleService-Info.plist
file from the firebase console? If that is the case, that is the file you have to add not the one that is already in your project.Can you also try re-running
flutterfire configure
to see if you do get the newGoogleService-Info.plist
file?
Thanks for looking into this.
CFBundleURLTypes
to the Info.plist
as suggested here in point 8 flutterfire configure
again after enabling sign-in with Google and cross checked that GoogleService-Info.plist
file inside ios/Runner
matches with one provided by Firebase.Hi @tahamaddam, please provide the code sample you're experiencing this issue with in a repo that we can clone so that we can investigate this issue.
Thank you
Hi @tahamaddam, please provide the code sample you're experiencing this issue with in a repo that we can clone so that we can investigate this issue.
Thank you
This a new project with only two files, main.dart
as shared above and firebase_options.dart
which is created by flutterfire configure
. In order to replicate, I guess you can create a new flutter project and attach it with firebase project.
Thanks for looking into this.
Hi @tahamaddam, this is an issue with your code. The value you have set as your clientId for the GoogleSignIn is not the correct value to set. The client ID can be found in your GoogleService-Info.plist
or your google-services.json
file for the respective platform.
Hi @tahamaddam, this is an issue with your code. The value you have set as your clientId for the GoogleSignIn is not the correct value to set. The client ID can be found in your
GoogleService-Info.plist
or yourgoogle-services.json
file for the respective platform.
Thanks, I tried that too but didn't work. In all the different tries, it never throws any error, always crash.
Thanks everyone for helping. This issue is resolved for iOS
After going through the whole process again, I realized that the Google client_id that I was providing to GoogleProvider(clientId:google-client-id'),
by directly copy pasting from Firebase>Authentication>Sign-in Methods>Google (as suggested here, here and other places) is different than the client id present in the GoogleService-Info.plist
file generated by the flutterfire configure
So after providing the client_id as in GoogleService-Info.plist
the app is no longer crashing and I successfully log-in
Though error issue on Android is still existing. "An unknown error occurred"
Hi @tahamaddam, what does your code look like now? I just tested google sign in on android and everything seems to work just fine. Would it be possible for you to get us the full error message? You might be able to get this from your debugger
@tahamaddam could you please remove this GoogleProvider(clientId: DefaultFirebaseOptions.currentPlatform.appId),
, Firebase appId
is not a google client id, and use iOSPreferPlist: true
for iOS?
@tahamaddam could you please remove this
GoogleProvider(clientId: DefaultFirebaseOptions.currentPlatform.appId),
, FirebaseappId
is not a google client id, and useiOSPreferPlist: true
for iOS?
Thanks, as I commented above, this issue has now been resolved for iOS. For Android, I am now trying to produce the error message so can further troubleshoot it.
Hi @tahamaddam, what does your code look like now? I just tested google sign in on android and everything seems to work just fine. Would it be possible for you to get us the full error message? You might be able to get this from your debugger
Thanks, this issue is now also resolved for Android,
How? I replaced the release keystore SHA-1 with debug keystore SHA-1. Did nothing else. I have been told that for release keystore SHA-1, I need to add following to build.gradle
signingConfigs {
release {
keyAlias '<alias>'
keyPassword '<keyPassword>'
storeFile file('<keystoreFile>')
storePassword '<storePassword>'
}
}
I have not tested with release keystore yet, but I hope it will be okay.
Thanks everyone for helping me out on this.
Is there an existing issue for this?
What plugin is this bug for?
Firebase UI Auth
What platform(s) does this bug affect?
Android, iOS
List of dependencies used.
flutter pub deps -s list
Steps to reproduce
flutterfire configure
to sync the firebase with local flutter projectfirebase_ui_auth
packageon iOS Emulator
on Android Emulator
Expected Behavior
I expect it to let me select the Google account and then register me as a new user on Firebase.
Actual Behavior
On iOS
App crashes and dialogue box opens to report the crash. The title of the dialogue box says "Runner quits unexpectedly"
On Android
Additional Information