Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Firebase authentication: What is the server Client's ID that's passed requestIdToken

I have implemented google sign-in with firebase authentication by following a tutorial that tells me what to do but offers no explanation on what I am actually doing.
Even though the app works, I have been trying to understand what the code actually does. I have been reading the documentation but couldn't understand everything.

GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
                .requestIdToken(getString(R.string.default_web_client_id))
                // TODO : What is IdToken
                .requestEmail()
                .build();

I have read everything about the requestIdToken, but I couldn't understand its role in the sign-in flow. What I found is :

You must pass your server's client ID to the requestIdToken method.

And this is information about server's client ID (Click on the link).

Despite reading all of that, I couldn't get what the requestIdToken function does and what is the server's client ID

Can someone please explain these?

like image 572
AG_HIHI Avatar asked Jan 18 '26 11:01

AG_HIHI


1 Answers

After a long day of trying to understand how google sign-in works and diving into a research rabbit hole, I kind of began to understand what this is all about.

When the user signs-in, I request the user's ID by passing my authentication server's web Client ID to the requestIdToken method .It can be used later on to verify the identity of the currently signed-in user.

like image 153
AG_HIHI Avatar answered Jan 20 '26 03:01

AG_HIHI



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!