Skip to main content
POST
/
api
/
v1
/
auth
/
google
Exchange Google ID token for Auth0 tokens
curl --request POST \
  --url https://handauncle-backend-prod-205012263523.asia-south1.run.app/api/v1/auth/google \
  --header 'Content-Type: application/json' \
  --data '
{
  "idToken": "<string>"
}
'
{
  "success": true,
  "data": {
    "accessToken": "<string>",
    "idToken": "<string>",
    "refreshToken": "<string>",
    "expiresIn": 123,
    "user": {
      "id": "<string>",
      "email": "jsmith@example.com",
      "name": "<string>",
      "picture": "<string>",
      "emailVerified": true,
      "phone": "<string>"
    }
  },
  "meta": {
    "timestamp": "2023-11-07T05:31:56Z",
    "requestId": "<string>"
  }
}
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:3000 is 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:
npx serve -l 3000
This starts a static file server on http://localhost:3000.
2

Open the token generator

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:
curl -X POST http://localhost:8080/api/v1/auth/google \
  -H "Content-Type: application/json" \
  -d '{"idToken": "YOUR_COPIED_TOKEN"}'

Features

FeatureDescription
Copy TokenOne-click copy to clipboard
Test APIBuilt-in button to test your backend directly from the tool
cURL ExampleAuto-generated cURL command with your token
The token generator tool is for development and testing only. Never use it in production or expose your Client ID publicly.

Body

application/json
idToken
string
required

Google ID token returned by the client SDK.

Response

Tokens issued

success
enum<boolean>
required
Available options:
true
data
object
required
meta
object
required