Complete reference for the ManaHalal authentication service
The ManaHalal Auth Service provides secure authentication for the ManaHalal ecosystem. It supports traditional email/password authentication as well as OAuth providers like Google.
https://api.manahalal.co
All authenticated requests must include session cookies. The service uses HTTP-only cookies for session management.
Create a new user account.
| Field | Type | Required | Description |
|---|---|---|---|
email |
string | Yes | User's email address |
password |
string | Yes | Password (min 8 characters) |
name |
string | No | User's full name |
{
"email": "user@example.com",
"password": "securePassword123",
"name": "John Doe"
}
{
"user": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"email": "user@example.com",
"name": "John Doe",
"createdAt": "2024-01-15T10:00:00Z"
}
}
Sign in with email and password.
| Field | Type | Required | Description |
|---|---|---|---|
email |
string | Yes | User's email address |
password |
string | Yes | User's password |
{
"email": "user@example.com",
"password": "securePassword123"
}
Sign out the current user.
No request body required. Will clear the session cookie.
Request a password reset link.
| Field | Type | Required | Description |
|---|---|---|---|
email |
string | Yes | Email address of the account |
{
"email": "user@example.com"
}
Reset password using a valid reset token.
| Field | Type | Required | Description |
|---|---|---|---|
token |
string | Yes | Reset token from email |
password |
string | Yes | New password (min 8 characters) |
{
"token": "reset_token_from_email",
"password": "newSecurePassword123"
}
Get the current user's session information.
{
"session": {
"id": "session_123",
"userId": "user_123",
"expiresAt": "2024-01-22T10:00:00Z"
},
"user": {
"id": "user_123",
"email": "user@example.com",
"name": "John Doe",
"createdAt": "2024-01-15T10:00:00Z"
}
}
Initiate Google OAuth sign-in flow.
Redirects the user to Google's OAuth consent screen.
OAuth callback endpoint. Handled automatically by the OAuth flow.
Sessions are managed using HTTP-only cookies. The cookies are:
better-auth.session_token - Main session tokenThe API returns standard HTTP status codes and JSON error responses:
{
"error": "Invalid credentials",
"code": "AUTH_INVALID_CREDENTIALS"
}
| Status | Code | Description |
|---|---|---|
400 |
VALIDATION_ERROR | Invalid request data |
401 |
AUTH_INVALID_CREDENTIALS | Invalid email or password |
401 |
AUTH_UNAUTHORIZED | Not authenticated |
409 |
AUTH_USER_EXISTS | Email already registered |
500 |
INTERNAL_ERROR | Server error |