How can I verify a Google authentication access token?
I need to somehow query Google and ask: Is [given access token] valid for the [exampl
Google oauth code flow response in addition to access_token
also returns id_token
that contains useful for validation info in encrypted form.
One thing that makes ID tokens useful is that fact that you can pass them around different components of your app. These components can use an ID token as a lightweight authentication mechanism authenticating the app and the user. But before you can use the information in the ID token or rely on it as an assertion that the user has authenticated, you must validate it.
Validation of an ID token requires several steps:
https://developers.google.com/identity/protocols/OpenIDConnect#validatinganidtoken link has code samples for validation of ID tokens.
See also https://security.stackexchange.com/questions/37818/why-use-openid-connect-instead-of-plain-oauth.