Google renders and controls the button. On click, the user authenticates and Google Identity Services calls back with a signed ID token (JWT) containing the user's profile โ no server round trip needed to show who signed in.
Raw response from Google (encoded JWT credential):
Decoded ID token payload:
Decoding above is not verification โ it's just base64-decoding the JWT's middle segment. Anyone can craft a fake JWT with any payload they like; decoding it locally proves nothing about who actually sent it.
Real verification checks that Google actually signed the token:
iss is accounts.google.comaud matches your OAuth client IDexp hasn't passedkidClick "Verify with Google" to call Google's tokeninfo endpoint:
GET https://oauth2.googleapis.com/tokeninfo?id_token=<the JWT>
It performs exactly the checks above and only echoes the
claims back if they're valid (otherwise it responds with an
error_description) โ this is the same kind of
call your previous backend was making (directly, or via a
JWT/JWKS library doing the same check locally instead of
calling Google over the network).
End-to-end flow:
gsi/client script