Skip to main content
POST
/
api
/
auth
/
google-login
Google Login
curl --request POST \
  --url https://api.example.com/api/auth/google-login \
  --header 'Content-Type: application/json' \
  --data '
{
  "credential": "<string>",
  "withVideo": true
}
'
{
  "error": "Google credential is required"
}
This endpoint handles both login and signup for users authenticating with Google. If the user doesn’t exist, a new account is automatically created. If the user exists, they are logged in.

Request Body

credential
string
required
The Google ID token credential obtained from Google Sign-In
withVideo
boolean
default:"true"
Whether the user wants to enable video in meetings. Defaults to true

Request Example

curl -X POST https://api.meetmates.com/api/auth/google-login \
  -H "Content-Type: application/json" \
  -d '{
    "credential": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjE5ZmUyYT...",
    "withVideo": true
  }'
{
  "credential": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjE5ZmUyYT...",
  "withVideo": true
}

Response

success
boolean
Indicates if the authentication was successful
message
string
Success message indicating whether it was a login or signup
  • “Google signup successful” - New user account created
  • “Google login successful” - Existing user logged in
token
string
JWT authentication token valid for 7 days. Include this in the Authorization header for protected endpoints
user
object
User information object

Response Example

{
  "success": true,
  "message": "Google login successful",
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "user": {
    "id": "507f1f77bcf86cd799439011",
    "email": "[email protected]",
    "name": "John Doe",
    "profilePicture": "https://lh3.googleusercontent.com/a/...",
    "isGoogleUser": true,
    "withVideo": true
  }
}

Error Responses

error
string
Error message describing what went wrong
details
string
Additional error details (only in development mode)

Error Codes

{
  "error": "Google credential is required"
}

Authentication

This endpoint does not require authentication. It is used to obtain the authentication token.

Notes

  • The Google credential must be a valid ID token from Google Sign-In
  • Google users are automatically marked as verified (isVerified: true)
  • If a user already exists with the same email, their account is updated with Google information
  • The JWT token expires after 7 days
  • Users created via Google auth don’t have a password set

Build docs developers (and LLMs) love