Autentikasi (Auth)
Dokumentasi API untuk proses pendaftaran, masuk (login), dan manajemen sesi pengguna di platform Atourin.
Endpoint Overview
| Method | Endpoint | Deskripsi |
|---|---|---|
| POST | /auth/otp | Mengirim kode OTP ke email pengguna. |
| POST | /auth/login_with_email_password | Masuk menggunakan email dan kata sandi. |
| POST | /auth/verify_legacy_password | Verifikasi dan migrasi password legacy. |
| POST | /auth/login_with_anonymous | Masuk sebagai tamu (anonymous). |
| GET | /auth/logout | Mengakhiri sesi pengguna. |
| POST | /auth/register | Mendaftarkan akun baru. |
1. Kirim OTP
Mengirimkan kode verifikasi (OTP) ke email pengguna untuk proses verifikasi.
- URL:
/auth/otp - Method:
POST - Body (JSON):
{
"email": "user@example.com"
}
- Response (200 OK):
{
"info": "Success send OTP",
"msg": "Ok"
}
2. Login Email & Password
Masuk ke akun yang sudah terdaftar.
- URL:
/auth/login_with_email_password - Method:
POST - Body (JSON):
{
"email": "user@example.com",
"password": "yourpassword"
}
- Response (200 OK):
{
"data": {
"access_token": "eyJhbG...",
"refresh_token": "...",
"user": { ... }
},
"info": "Success login",
"msg": "Ok"
}
3. Verify Legacy Password
Verifikasi kredensial pengguna dari sistem lama (legacy) dan migrasi data ke sistem baru secara otomatis. Jika verifikasi berhasil, pengguna akan langsung mendapatkan token akses.
- URL:
/auth/verify_legacy_password - Method:
POST - Body (JSON):
{
"email": "user@example.com",
"password": "your_legacy_password"
}
- Response (200 OK):
{
"status": true,
"code": 200,
"info": "Success verify and migrate legacy user",
"msg": "Ok",
"data": {
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "bearer",
"expires_in": 3600,
"expires_at": 1705312800,
"refresh_token": "refresh_token_here",
"user": {
"id": "3c662a10-d9b1-438c-bfa7-eac70051f5ac",
"email": "user@example.com",
"user_metadata": {
"name": "User Name"
}
}
}
}
4. Login Anonymous
Masuk sebagai pengguna anonim untuk mendapatkan akses dasar tanpa akun.
- URL:
/auth/login_with_anonymous - Method:
POST - Body (JSON):
{
"email": "null",
"password": "null"
}
- Response (200 OK): Mengembalikan token akses dengan peran
anonymous.
5. Logout
Menghapus sesi token pengguna dan menonaktifkan akses token yang sedang digunakan.
- URL:
/auth/logout - Method:
GET - Headers:
Authorization: Bearer {{token}} - Response (200 OK):
{
"code": 200,
"info": "Success logout user",
"msg": "Ok",
"status": true
}
6. Refresh Token (Supabase)
Memperbarui access_token yang sudah kedaluwarsa menggunakan refresh_token.
- URL:
{{sb_url}}/auth/v1/token?grant_type=refresh_token - Method:
POST - Headers:
apikey: {{sb_key}} - Body (JSON):
{
"refresh_token": "your_refresh_token"
}
7. Registrasi Akun Baru
Mendaftarkan akun baru ke platform Atourin. Pastikan email belum pernah terdaftar sebelumnya.
- URL:
/auth/register - Method:
POST - Body (JSON):
{
"name": "Admin Atourin",
"email": "info@atourin.com",
"password": "your_password"
}
- Response (200 OK):
{
"code": 200,
"data": {
"id": "3c662a10-d9b1-438c-bfa7-eac70051f5ac",
"email": "info@atourin.com",
"created_at": "2026-03-23T06:39:34Z",
"info": "Pendaftaran berhasil, silakan cek email untuk verifikasi"
},
"info": "Pendaftaran berhasil, silakan cek email untuk verifikasi",
"msg": "Ok",
"status": true
}
🔥 Uji Coba API (Simulator)
Gunakan simulator di bawah ini untuk mencoba seluruh endpoint di atas secara langsung. Anda dapat mengubah URL, Method, Headers, dan Body sesuai kebutuhan.