I'm using the google sign-in workflow to get a GoogleSignInAccount object. I want to authenticate google users to my firebase app, which requires a token which can be requested using requestIdToken(String serverClientId) when building my google client api. I'm not sure what to put as my serverClientId?
To avoid java.lang.IllegalArgumentException: Must specify an idToken or an accessToken
, use
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(googleClientId)
.requestEmail()
.build();
[find googleClientId - Here
This is what FirebaseUI 0.3 uses to build the sign-in options:
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(googleClientId)
.requestEmail()
.build();
Where googleClientId
is the client ID as described in the Firebase documentation for Google authentication. The most important thing to note there is that you need to create a web application, despite the fact that you're building an Android app.
But: you don't need to specify an id token anymore these days. In FirebaseUI 0.3.1, we'll be switching to this for building the sign-in options:
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
.build();
One less configuration value to worry about. :-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With