Authentication API Operations

Our Authentication API allows users to securely log in and obtain an access token for further API interactions. User data will be reset every Monday 00:00 Server Time.

Base URL: https://fdelux.globeapp.dev/api

Endpoint Summary

Method Path Description
POST: /api/login Login User
POST: /api/register Register New User

Login User

  • Method: POST
  • Endpoint: /login

Example Request URL: https://fdelux.globeapp.dev/api/login

Request

headers
{
  "Content-Type": "application/json"
}
body
{
  "email": "[email protected]",
  "password": "password"
}

Responses

200 OK
{
    "message": "Login successful",
    "data": {
        "token": {
            "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxIiwiZW1haWwiOiJ0b255c3RhbmtAZXhhbXBsZS5jb20iLCJuYW1lIjoiVG9ueSBTdGFuayIsInJvbGUiOiJjb21tb25fdXNlciIsImlhdCI6MTc1Mjg0Mjk5OCwiZXhwIjoxNzUzMDE1Nzk4LCJpc3MiOiJodHRwczovL2dpdGh1Yi5jb20vam9uYXNyb3Vzc2VsL2RhcnRfanNvbndlYnRva2VuIiwianRpIjoiMTc1Mjg0Mjk5ODkwNSJ9.z7y-UFhTjWfs-3N9gS5MK6WuV4dqqBjPYf8Z54Ox3cs",
            "refresh_token": "mock_refresh_token_for_now_j2hsliyRjh2hsliyRj2hsliyRj",
            "type": "Bearer",
            "expires_in": 172800
        },
        "user": {
            "id": 1,
            "name": "Tony Stank",
            "email": "[email protected]",
            "phone_number": "+628123456789",
            "city": "Garut",
            "address": "North Garut, West Java, Indonesia",
            "postal_code": "44151",
            "photo_url": "https://fdelux.globeapp.dev/images/pexels-louaifatmi-32058499.jpg",
            "created_at": "2025-07-17T07:36:00.000Z",
            "updated_at": "2025-07-17T07:36:00.000Z"
        }
    }
}
400 Bad Request (Invalid Body Format)
{
  "message": "Request body must be a valid JSON object.",
  "details": "Expected a JSON object but received: String"
}
400 Bad Request (Missing Fields)
{
  "message": "Both \"email\" and \"password\" are required.",
  "details": "Please provide both email and password in the request body."
}
401 Unauthenticated
{
  "message": "Invalid email or password.",
  "details": "The provided credentials do not match our records."
}
405 Method Not Allowed
{
  "message": "Only POST requests are supported for this endpoint.",
  "details": "Please use POST to submit your login credentials."
}

Register User

  • Method: POST
  • Endpoint: /register

Example Request URL: https://fdelux.globeapp.dev/api/register

Request

headers
{
  "Content-Type": "application/json"
}
body
{
  "name": "Lebowski",
  "email": "[email protected]",
  "password": "pass1234"
}

Responses

201 Created
{
    "message": "Registration successful",
    "data": {
        "token": {
            "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMiIsImVtYWlsIjoibGVib3dza2lAZXhhbXBsZS5jb20iLCJuYW1lIjoiTGVib3dza2kiLCJyb2xlIjoiY29tbW9uX3VzZXIiLCJpYXQiOjE3NTI4NDMyMzksImV4cCI6MTc1MzAxNjAzOSwiaXNzIjoiaHR0cHM6Ly9naXRodWIuY29tL2pvbmFzcm91c3NlbC9kYXJ0X2pzb253ZWJ0b2tlbiIsImp0aSI6IjE3NTI4NDMyMzk2NTgifQ.M5hTRXWs4gL3OtCOkMrlpZVvkZz3Fs3tMt2_B81hDho",
            "refresh_token": "mock_refresh_token_for_now_j2hsliyRjh2hsliyRj2hsliyRj",
            "type": "Bearer",
            "expires_in": 172800
        },
        "user": {
            "id": 12,
            "name": "Lebowski",
            "email": "[email protected]",
            "phone_number": "+628123456789",
            "city": "Garut",
            "address": "North Garut, West Java, Indonesia",
            "postal_code": "44151",
            "photo_url": "https://fdelux.globeapp.dev/images/pexels-louaifatmi-32058499.jpg",
            "created_at": "2025-07-18T12:53:59.657268Z",
            "updated_at": "2025-07-18T12:53:59.657268Z"
        }
    }
}
400 Bad Request (Invalid Body Format)
{
  "message": "Request body must be a valid JSON object.",
  "details": "Expected a JSON object but received: String"
}
400 Bad Request (Missing Fields)
{
  "message": "All fields (name, email, password) are required.",
  "details": "Please provide valid name, email, and password in the request body."
}
409 Conflict
{
  "message": "User with this email already exists.",
  "details": "Please use a different email address for registration."
}
500 Internal Server Error
{
  "message": "An unexpected error occurred during registration.",
  "details": "Please try again later or contact support."
}
405 Method Not Allowed
{
  "message": "Only POST requests are supported for this endpoint.",
  "details": "Please use POST to submit your registration details."
}