Issue
I developed a React Native app, and I am using Expo Google-Sign-In for my Firebase authentication. I receive the error "DEVELOPER_ERROR" when I attempt authentication on my standalone APK on Android.
Initially, I was using "Expo Google", however that is now deprecated and my sign-in button did not do anything on my standalone APK. With Expo Google method, I found that I had to set the androidStandaloneAppClientId. Even after that, the sign-in got stuck at the Google homepage after authentication. I tried the solution of using a custom redirect URI, as in
redirectUrl: ${AppAuth.OAuthRedirect}:/oauth2redirect/google
but that resulted in another error: redirect_uri mismatch.
I switched to the Expo Google-Sign-In library instead, and that is giving me a DEVELOPER_ERROR every time I try to authenticate.
After that, I have tried:
- downloading the google-services.json and using it in my app
- setting the SHA1 fingerprint in google-services.json and in Firebase
- setting the certificateHash inside android.configuration.certificate hash inside my app.json to my SHA1 fingerprint.
- checking and making sure package names are set properly
I tried anything else I may have failed to mention from the existing threads involving DEVELOPER_ERROR in Expo Google-Sign-In.
The variables I mention in my code below are from the following:
SHA1 was generated and used to create my credential, and is the fingerprint used in my OAuth Android Client ID.
The client ID I reference throughout my files is the ID of my OAuth Web client ID. However, I also tried using the Android one and that did not change anything.
"CurrentKey" in api_key is the API key from my Firebase project.
This is a link to my Google Credentials page.
https://i.stack.imgur.com/MVfO2.jpg
/* My app.json: */
{
"expo": {
"name": "AssistiveNote",
"privacy": "public",
"description": "A note app for people who have trouble reading text.",
"slug": "assistivenote",
"sdkVersion": "33.0.0",
"version": "2.0.0",
"orientation": "portrait",
"icon": "./screens/images/icon.png",
"ios": {
"bundleIdentifier": "com.danyalbabar.assistivenote"
},
"android": {
"versionCode": 2,
"package": "com.danyalbabar.assistivenote",
"googleServicesFile": "./google-services.json",
"permissions": [ " " ],
"config": {
"googleSignIn": {
"certificateHash": "XXXX"
}
}
}
}
}
My google-services.json:
{
"project_info": {
"project_number": "XXXX",
"firebase_url": "https://era-gvision.firebaseio.com",
"project_id": "era-gvision",
"storage_bucket": "era-gvision.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "XXXX",
"android_client_info": {
"package_name": "com.danyalbabar.assistivenote"
}
},
"oauth_client": [
{
"client_id": "XXXX",
"client_type": 3
}
],
"api_key": [
{
"current_key": "XXXX"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "XXXX",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}
Solution
Overall it seemed like there was a lot of broken behaviour with this API and it is now deprecated. I moved on to use email/password authentication at the time, but there are now updated Expo APIs that are implemented in new ways.
https://docs.expo.io/guides/authentication/
Answered By - DanyalBabar
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.