Skip to main content
POST
Google OAuth Login

Endpoint

Authenticates a user using Google OAuth. Creates a new user account if the Google account is not already registered, or logs in an existing user.

Request Body

string
required
Google ID token obtained from Google Sign-In on the client side.

Response

boolean
Indicates whether the request was successful.
object
Contains the user data and JWT token.

Status Codes

Success
Authentication successful. Returns user data and JWT token.
Bad Request
Missing Google token in request body.
Unauthorized
Invalid or expired Google token.

Error Response

or

Example Request

cURL
JavaScript
Python

Example Response

Implementation Notes

New User Registration

When a user authenticates with Google for the first time:
  • A new user account is automatically created
  • User information is populated from the Google profile
  • A customer profile is created and linked to the user
  • A welcome email is sent to the user’s email address
  • The password field is set to an empty string (password login is disabled)

Existing User Login

When a user with an existing account authenticates:
  • If the user doesn’t have a googleId yet, it will be added to their profile
  • The user is logged in and receives a new JWT token

Client-Side Integration

To use this endpoint, you need to:
  1. Set up Google Sign-In on your client application
  2. Obtain the Google ID token after successful sign-in
  3. Send the token to this endpoint
Example using Google Sign-In JavaScript library:

Security Notes

  • The Google ID token is verified server-side using the Google Auth Library
  • The token must be issued by Google and intended for your application’s client ID
  • Users authenticated via Google will have an empty password field and cannot use email/password login unless they set a password separately