Exchange Google ID token for Auth0 tokens
Auth service
Google OAuth (Token Exchange)
POST
Exchange Google ID token for Auth0 tokens
Exchange a Google ID token (obtained via the native/mobile SDK) for Auth0
accessToken, idToken, and refreshToken. The backend also syncs the user
record into MongoDB on first login.
Testing with the Token Generator Tool
We provide a simple HTML tool to generate Google ID tokens for testing your API locally.Prerequisites
- A Google OAuth Client ID from Google Cloud Console
- Make sure
http://localhost:3000is added to the Authorized JavaScript origins in your OAuth client configuration
Running the Token Generator
1
Start the local server
From the project root, run:This starts a static file server on
http://localhost:3000.2
Open the token generator
Navigate to http://localhost:3000/test-google-token.html in your browser.
3
Enter your Client ID
Paste your Google OAuth Client ID into the input field and press Enter or click the “Sign in with Google” button.
4
Sign in with Google
Complete the Google sign-in flow. Once authenticated, your ID token will be displayed.
5
Use the token
Copy the token and use it to test the
/api/v1/auth/google endpoint:Features
The token generator tool is for development and testing only. Never use it in production or expose your Client ID publicly.