Google OAuth Login
Authentication
Google OAuth Login
Authenticate a user with Google OAuth
POST
Google OAuth Login
Endpoint
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
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
passwordfield 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
googleIdyet, 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:- Set up Google Sign-In on your client application
- Obtain the Google ID token after successful sign-in
- Send the token to this endpoint
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
passwordfield and cannot use email/password login unless they set a password separately