🌙 ManaHalal Auth API Documentation

Reference for the ManaHalal authentication service

Overview

The ManaHalal Auth Service provides secure authentication for the ManaHalal ecosystem. It supports sign-in by email code, passkey and Google.

Base URL

https://api.manahalal.com

Authentication

All authenticated requests must include session cookies. The service uses HTTP-only cookies for session management.

Authentication Endpoints

POST /api/auth/sign-out

Sign out the current user.

No request body required. Will clear the session cookie.

User Management

GET /api/auth/get-session

Get the current user's session information.

Response

{
  "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"
  }
}

OAuth Integration

GET /api/auth/callback/google

OAuth callback endpoint. Handled automatically by the OAuth flow.

Session Management

Sessions are managed using HTTP-only cookies. The cookies are:

Error Handling

The API returns standard HTTP status codes and JSON error responses:

{
  "error": "An unexpected error occurred. Please try again later.",
  "code": "INTERNAL_ERROR"
}

Common Error Codes

Status Code Description
400 VALIDATION_ERROR Invalid request data
500 INTERNAL_ERROR Server error
↑