Authentication API Operations

Our Authentication API allows users to securely log in and obtain an access token for further API interactions.

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",
      "refresh_token": "yohohohojh2hsliyRjh2hsliyRj2hsliyRj",
      "type": "Bearer",
      "expires_in": 3600
    },
    "user": {
      "id": 1,
      "name": "Tony Stank",
      "email": "[email protected]",
      "phone_number": "+628123456789",
      "city": "Garut",
      "address": "Jl. Raya No. 123, North Garut, West Java, Indonesia",
      "postal_code": "44151",
      "photo_url": "https://fdelux.globeapp.dev/images/pexels-louaifatmi-32058499.jpg"
    }
  }
}
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": "password"
}

Responses

201 Created
{
  "message": "Registration successful",
  "data": {
    "user": {
      "id": 2,
      "name": "Lebowski",
      "email": "[email protected]"
    }
  }
}
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."
}