Today we’re going to learn how we can verify a token generated with Google Sign-In from a front-end client by sending it to the back-end.

In this case, we’ll be using Python.
Returns only the HTML translated, without any addition.
Here’s a step-by-step tutorial for validating a Google Sign-In token in Python using the google-auth
library. Of course,
Make sure you have the google-auth
library installed by running the following command in your terminal or console:
pip install google-auth
Ensure that you have set up an application in the Google Cloud Console. Get the client ID of your application; you’ll need it to validate the token.
Create a Python script with the following code:
Make sure to replace 'your_google_client_id'
with the client ID of your application.
Here’s how you can get the Google client ID (https://devcodelight.com/?p=7297). You’ll need to follow those steps until you download the .json file; the Google client ID is within that file:

NOTE: Remember that the token to be validated is of type oauth and is obtained from a GoogleSignInAccount with the idToken attribute
Save the script with a descriptive name, for example, validate_google_token.py
. Then, execute it from the terminal or console:
python validate_google_token.py
The script will indicate whether the token is valid or not and will display the user information if the token is valid.
