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 Glass Next 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. |
| storefrontId | string (UUID) | No | Optional storefront UUID. Required when your account is restricted to specific storefronts and you do not have an active vendor membership. |
Request example
curl -X POST 'http://localhost:8080/api/v1/auth/login' \
-H 'Content-Type: application/json' \
-d '{
"email": "testvendor2@glass.com",
"password": "TestVendor2",
"storefrontId": "550e8400-e29b-41d4-a716-446655440000"
}'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",
"email": "vendor@example.com",
"firstName": "Jane",
"lastName": "Vendor",
"role": "USER",
"verified": true,
"status": "ACTIVE"
},
"vendor": {
"id": "550e8400-e29b-41d4-a716-446655440010",
"name": "Jane's Store",
"slug": "janes-store",
"status": "ACTIVE"
}
}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",
"email": "buyer@example.com",
"firstName": "John",
"lastName": "Buyer",
"role": "USER",
"verified": true,
"status": "ACTIVE"
},
"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"
}The user is restricted to specific storefronts and the request is missing or has an invalid storefrontId.
{
"statusCode": 403,
"message": "This user is not authorized for this storefront",
"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 or not authorized for the storefront.
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.