FirebaseUI-Android icon indicating copy to clipboard operation
FirebaseUI-Android copied to clipboard

the default_web_client_id string wasn't populated

Open Sutheres opened this issue 8 years ago • 40 comments

Using these libraries:

implementation 'com.firebaseui:firebase-ui-auth:4.1.0' implementation 'com.google.firebase:firebase-auth:16.0.1' implementation 'com.google.android.gms:play-services-auth:15.0.1'

And this code:

`AuthUI.IdpConfig googleIdp = new AuthUI.IdpConfig.GoogleBuilder().build(); AuthUI.IdpConfig facebookIdp = new AuthUI.IdpConfig.FacebookBuilder().build(); AuthUI.IdpConfig emailIdp = new AuthUI.IdpConfig.EmailBuilder().build(); //not signed in startActivityForResult(

                        AuthUI.getInstance()
                                .createSignInIntentBuilder()
                                .setAvailableProviders(Arrays.asList(facebookIdp, emailIdp))
                                .setIsSmartLockEnabled(false)
                                .setLogo(R.mipmap.app_icon)
                                .build(),
                        RC_SIGN_IN);`

Sutheres avatar Jun 29 '18 15:06 Sutheres

I'm experiencing the same error with the latest libraries (just set it up today).

Here is the bottom of my app/build.grade. Does anything look wrong?

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:design:28.0.0'
    implementation 'org.json:json:20180813'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.google.firebase:firebase-core:16.0.8'
    implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
    implementation 'com.facebook.android:facebook-android-sdk:4.41.0'

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

apply plugin: 'com.google.gms.google-services'

Manually adding the key to strings.xml works, but I'd obviously like to avoid that.

kylecombes avatar Apr 03 '19 19:04 kylecombes

@Sutheres I have all the latest libraries but still no luck.

rajasone avatar Apr 03 '19 19:04 rajasone

Same here. I am getting the same error, having just things up today with the latest libraries etc. I've added the manual key in 'strings.xml' but yes, it would be nice to really solve this.

hpols avatar Apr 04 '19 12:04 hpols

I am getting the same error. My app dependencies: implementation 'com.google.firebase:firebase-core:16.0.8' implementation 'com.firebaseui:firebase-ui-auth:4.3.2'

noblesilence avatar Apr 04 '19 14:04 noblesilence

Well The solution is simple and easy. Most of the developers finds the error when they closed the project and reopen it then the default_web_client error results.

Solution: You need to add the client id in the res-->values-->string <string name="default_web_client_id" translatable="false">xxxxxxxx</string> for the client id(xxxxxxxxx) you can go to Firebase console and paste here. https://youtu.be/Uwuy17eouCg ### This video will guide you properly.

am9072 avatar Apr 05 '19 13:04 am9072

@am9072 the link you gave for the video doesn't open Youtube. Followed what you wrote now though. Is this a temporary fix or an actual one?

Thanks, Sohaib

msfm7 avatar Apr 05 '19 13:04 msfm7

It seems that the problem is with google-services.json file generated on Firebase website, not with the Firebase Auth UI. Even after I removed the Firebase Auth UI and used the regular Firebase Authentication method, the error still occurs.

I found more info on this stack overflow thread: https://stackoverflow.com/questions/37810552/cannot-resolve-symbol-default-web-client-id-in-firebases-android-codelab I tried all methods suggested in that thread but still no luck. I hard-coded the idToken string in the Java code for now.

noblesilence avatar Apr 06 '19 10:04 noblesilence

@noblesilence _default_web_client_id_ is automatically generated, its under generated files of google-services values.xml,

Unfortunately, we can't edit that file so there are two possible fixes,

  1. try refreshing and rebuilding your gradle and if that doesn't fix it you can :
  2. manually go to you google API panel > goto credentials > there would be web client in OAuth section from there just copy that in your strings.xml and use that, p.s don't forget to select the right app in google API panel

If your using firebase Auth for google sign in

  1. you can go to your firebase panel directly
  2. select Authorization, select sign-in method tab, click on google sign in,
  3. The popup for google sign in enable/disable option there is also a section called web client id.
  4. copy paste section called web client id. that to your string.xml and use that.

check my article regarding this : fixing default-web-client-id

ch8n avatar Apr 06 '19 11:04 ch8n

I got this error yesteday and it was because firebase console didnt add web client id object into generated google-services.json file: more details

cetonek avatar Apr 08 '19 05:04 cetonek

Hi everyone - this sounds like there's some issue with how the Firebase console is generating the google-services.json file. I will flag this to that team, thank you for all of your reports!

samtstern avatar Apr 08 '19 13:04 samtstern

An update: we think we introduced a bug in the backend that makes the JSON files so we are undoing some recent changes. We hope this will fix the issue and we will investigate what happened.

samtstern avatar Apr 08 '19 14:04 samtstern

@ch8n Thanks. I got default_web_client_id from Web SDK configuration in my Firebase console(

select Authorization, select sign in method tab, click on google signin, the popup for google sign in enable/ disable option there is also a section called web client id.

) and manually paste { "client_id": "my_web_client_id_.apps.googleusercontent.com", "client_type": 3 } into

"oauth_client": [] array in my google-service.json and it works

picklepickle1 avatar Apr 09 '19 11:04 picklepickle1

I set up firebase using the default UI a couple of weeks ago without any issues, now I'm also seeing java.lang.IllegalStateException: Check your google-services plugin configuration, the default_web_client_id string wasn't populated. I tried redownloading the JSON, recreating my project, and updating all of my dependencies

Error occurs when hitting this part:

// Choose authentication providers List<AuthUI.IdpConfig> providers = Arrays.asList( new AuthUI.IdpConfig.EmailBuilder().build(), new AuthUI.IdpConfig.GoogleBuilder().build());

dependencies:

implementation 'com.google.android.gms:play-services-auth:16.0.1' implementation 'com.google.android.gms:play-services-identity:16.0.0' implementation 'com.firebaseui:firebase-ui-auth:4.3.1' implementation 'com.google.firebase:firebase-auth:16.2.1' implementation "com.google.firebase:firebase-firestore:18.2.0"

Yori1 avatar Apr 09 '19 13:04 Yori1

In the next backend rollout, the google-services.json will again contain the correct web client ID values.

samtstern avatar Apr 09 '19 17:04 samtstern

@samtstern cool thanks :+1:

rajasone avatar Apr 09 '19 18:04 rajasone

@samtstern When do you expect next backend rollout?

wildfisher avatar Apr 09 '19 18:04 wildfisher

The backend should be live now, download a new google-services.json to resolve this issue.

samtstern avatar Apr 10 '19 17:04 samtstern

I am still having the same problem :( I tried steps from above, nothing helps, except for hardcoding the web id :(

I am setting up user sign in via google account as per Firebase manual: https://firebase.google.com/docs/auth/android/google-signin "default_web_client_id" value should be populated from google-services.json to the automatically built values.xml file. I have downloaded google-services.json from the Firebase website and it looks good, json file shows proper value of the web client id (this value works if hardcoded). However during build, this value is not populated to values.xml.

In the build.gradle file I have: implementation platform('com.google.firebase:firebase-bom:26.5.0') implementation 'com.google.firebase:firebase-auth' implementation 'com.firebaseui:firebase-ui-auth:4.3.2' implementation 'com.google.android.gms:play-services-auth:19.0.0'

For now problem is resolved by nothing but hardcoding..

Liker777 avatar Mar 01 '21 05:03 Liker777

Although it's late but for reference

  1. Get web client id from firebase console Firebase console -> Select app -> Authentication -> Select Google -> open last dropdown (Web SDK configuration) -> Copy Web Client ID.
  2. Add below line in res -> values->strings.xml <string name="default_web_client_id" translatable="false">Coppied Web Client ID</string> This worked for me.

adityakpranav avatar Sep 04 '21 15:09 adityakpranav

Thanks a lot

On Sat, Sep 4, 2021, 6:00 PM Night Fury @.***> wrote:

Although it's late but for reference

  1. Get web client id from firebase console Firebase console -> Select app -> Authentication -> Select Google -> open last dropdown (Web SDK configuration) -> Copy Web Client ID.
  2. Add below line in res -> values->strings.xml Coppied Web Client ID This worked for me.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/firebase/FirebaseUI-Android/issues/1381#issuecomment-912988007, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADJJZWA67UIQAEPFCL35ZODUAIYBVANCNFSM4FHVABMA .

Liker777 avatar Sep 05 '21 07:09 Liker777