Login
POST /auth/login — Authenticate with email and password to receive a bearer token.
/auth/loginNo authenticationLogin
Authenticate with email and password to receive a bearer token. Works for all user types — admins, vendor members, and buyers.
This is the single login endpoint for the G-Commerce REST API. Send your email and password, and the API returns a JWT access token plus your user profile. If your account is linked to an active vendor, the response also includes vendor details.
When to use this
- Starting an automated integration that needs to call protected vendor endpoints.
- Authenticating as a vendor team member and receiving vendor context in the response.
- Obtaining a fresh token when your previous token has expired (tokens expire after 7 days).
Request body
| Name | Type | Required | Description |
|---|---|---|---|
| string | Yes | The email address associated with your account. | |
| password | string | Yes | Your account password. |
Request example
curl -X POST 'https://api.next.gcommerce.glass/api/v1/auth/login' \
-H 'Content-Type: application/json' \
-d '{
"email": "seed-vendor@glass.dev",
"password": "SeedTest123!"
}'Response examples
Login successful. When the user has an active vendor membership, vendor details are included.
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user": {
"id": "550e8400-e29b-41d4-a716-446655440001",
"firstName": "Jane",
"lastName": "Vendor",
"email": "vendor@example.com",
"storefronts": [
{
"id": "550e8400-e29b-41d4-a716-446655440050",
"name": "G-Commerce",
"slug": "g-commerce",
"url": "https://g-commerce.example.com",
"status": "active"
}
]
},
"vendor": {
"id": "550e8400-e29b-41d4-a716-446655440010",
"status": "ACTIVE",
"name": "Jane's Store",
"slug": "janes-store",
"code": "O08",
"dba": null,
"restrictProducts": false
}
}Login successful. The vendor field is null when the user has no active vendor membership.
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user": {
"id": "550e8400-e29b-41d4-a716-446655440002",
"firstName": "John",
"lastName": "Buyer",
"email": "buyer@example.com",
"storefronts": []
},
"vendor": null
}Email or password is incorrect, or the account is inactive.
{
"statusCode": 401,
"message": "Invalid credentials",
"error": "Unauthorized"
}The account exists but email verification is not complete.
{
"statusCode": 403,
"message": "USER_NOT_VERIFIED",
"error": "Forbidden"
}Status codes
OK
Authentication succeeded. Token and user returned.
Bad Request
Validation failed (invalid email format, missing fields).
Unauthorized
Invalid email/password or inactive account.
Forbidden
Account not verified.
Too Many Requests
Rate limit exceeded (10 requests per 15 minutes on login).
Internal Server Error
Unexpected server error.
Try it
Log in here first — your token and vendor ID will be saved for all other endpoints.