2.1 KiB
2.1 KiB
Explore Lumajang Authentication API
Base URL for local Android emulator:
http://10.0.2.2:8000/api
Base URL for local backend:
http://127.0.0.1:8000/api
Register
POST /register
{
"name": "Lumajang Traveler",
"email": "traveler@example.com",
"password": "password123",
"password_confirmation": "password123"
}
Success 201:
{
"status": true,
"message": "Registration successful. Please log in.",
"data": {
"user": {
"id": 1,
"name": "Lumajang Traveler",
"email": "traveler@example.com",
"created_at": "2026-05-14T06:30:00.000000Z"
}
}
}
Login
POST /login
{
"email": "traveler@example.com",
"password": "password123"
}
Success 200:
{
"status": true,
"message": "Login successful.",
"data": {
"token_type": "Bearer",
"token": "plain-text-mobile-token",
"user": {
"id": 1,
"name": "Lumajang Traveler",
"email": "traveler@example.com",
"created_at": "2026-05-14T06:30:00.000000Z"
}
}
}
Profile
GET /profile
Header:
Authorization: Bearer plain-text-mobile-token
Success 200:
{
"status": true,
"message": "User profile loaded.",
"data": {
"user": {
"id": 1,
"name": "Lumajang Traveler",
"email": "traveler@example.com",
"created_at": "2026-05-14T06:30:00.000000Z"
}
}
}
Forgot Password
POST /forgot-password
{
"email": "traveler@example.com"
}
Success 200:
{
"status": true,
"message": "Password reset instructions have been sent if the email is registered."
}
In local development, the reset token is written to Laravel logs. Configure SMTP before production email delivery.
Logout
POST /logout
Header:
Authorization: Bearer plain-text-mobile-token
Success 200:
{
"status": true,
"message": "Logout successful."
}
Error Example
Validation errors use Laravel's standard 422 JSON format:
{
"message": "The email field is required.",
"errors": {
"email": [
"The email field is required."
]
}
}