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?
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.
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