auth
Login user
When the project has **requireEmailVerification** enabled and the user has not verified their email, returns 403 with code **EMAIL_VERIFICATION_REQUIRED** (user must verify email first, then login again).
POST
/api/auth/local/loginAuthentication
Public — No Auth Required
Request Body
Login credentials (email, password) and project ID.
json
{
"email": "amari_koss69@northwind.dev",
"password": "Str0ng_Sample_Pass!w0rd",
"projectId": "proj_qh5hFHNT70YZ"
}{
"email": "amari_koss69@northwind.dev",
"password": "Str0ng_Sample_Pass!w0rd",
"projectId": "proj_qh5hFHNT70YZ"
}SDK setup
Create a client instance. No authentication is required for this endpoint.
import { MudbaseClient } from "mudbase";
const client = new MudbaseClient();import { MudbaseClient } from "mudbase";
const client = new MudbaseClient();Example request
Call this endpoint using the client from SDK setup. Use View HTTP for a raw cURL example.
const result = await client.auth.login({
email: "elmore.hilll62@northwind.dev",
password: "Str0ng_Sample_Pass!w0rd",
projectId: "proj_cRqxoHbqSH82"
});const result = await client.auth.login({
email: "elmore.hilll62@northwind.dev",
password: "Str0ng_Sample_Pass!w0rd",
projectId: "proj_cRqxoHbqSH82"
});Try It Live
Test this endpoint with your own credentials. Your requests will be sent to the live API.
No Request Yet
Send a request to see the full inspector
Responses
200Login successful
json
{
"message": "Login successful",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresIn": 1800,
"user": {
"id": "685acbe0e129932fbb7a0fc2",
"email": "john.doe@mudbase.dev",
"firstName": "John",
"lastName": "Doe",
"role": "developer",
"emailVerified": true,
"twoFactorEnabled": false
}
}{
"message": "Login successful",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresIn": 1800,
"user": {
"id": "685acbe0e129932fbb7a0fc2",
"email": "john.doe@mudbase.dev",
"firstName": "John",
"lastName": "Doe",
"role": "developer",
"emailVerified": true,
"twoFactorEnabled": false
}
}400Bad request or validation error.
401Authentication required or invalid token.
403Email verification required (project has requireEmailVerification and user has not verified)
json
{
"error": "Email verification required",
"code": "EMAIL_VERIFICATION_REQUIRED",
"message": "Please verify your email to sign in. Check your inbox for the verification link."
}{
"error": "Email verification required",
"code": "EMAIL_VERIFICATION_REQUIRED",
"message": "Please verify your email to sign in. Check your inbox for the verification link."
}429Rate limit exceeded.
500Internal server error.
Errors
| Code | Meaning |
|---|---|
400 | Bad request or validation error. |
401 | Authentication required or invalid token. |
403 | Email verification required (project has requireEmailVerification and user has not verified) |
429 | Rate limit exceeded. |
500 | Internal server error. |