Authenticate User & Issue JWT Access Token
curl --request POST \
--url https://api.example.com/api/identity/token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data username=auditor.user@telkom.co.id \
--data 'password=SecurePassword2026!'import requests
url = "https://api.example.com/api/identity/token"
payload = {
"username": "auditor.user@telkom.co.id",
"password": "SecurePassword2026!"
}
headers = {"Content-Type": "application/x-www-form-urlencoded"}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({username: 'auditor.user@telkom.co.id', password: 'SecurePassword2026!'})
};
fetch('https://api.example.com/api/identity/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/identity/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "username=auditor.user%40telkom.co.id&password=SecurePassword2026%21",
CURLOPT_HTTPHEADER => [
"Content-Type: application/x-www-form-urlencoded"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/identity/token"
payload := strings.NewReader("username=auditor.user%40telkom.co.id&password=SecurePassword2026%21")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/identity/token")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("username=auditor.user%40telkom.co.id&password=SecurePassword2026%21")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/identity/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "username=auditor.user%40telkom.co.id&password=SecurePassword2026%21"
response = http.request(request)
puts response.read_body{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c3JfMDE4ZjNhNTUiLCJleHAiOjE3MTgwMDAwMDB9.sample_sig",
"refresh_token": "dGhpcy1pcy1hLXNlY3VyZS1yZWZyZXNoLXRva2VuLTIwMjY...",
"token_type": "bearer",
"expires_in": 3600
}{
"detail": {
"mfa": true,
"mfa_token": "mfa_sess_tok_998877aabbcc",
"mfa_methods": [
"email_otp",
"totp"
]
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authentication
Authenticate User & Issue JWT Access Token
Overview
Authenticates a user using credentials (username/email and password).
Authentication & Headers
- Auth: Public (OAuth2 Password Flow)
- Required Header:
API-Version: 1 - Optional Header:
X-Device-ID: <device-uuid>for client binding and anomaly tracking
Parameters & Request Body
username(string, required): The registered account email or username.password(string, required): The account plaintext password.
Behavior & MFA Flow
- Standard Flow: If MFA is disabled for the account, returns
200 OKwithaccess_token(JWT) andrefresh_token. - MFA Flow: If Multi-Factor Authentication is enabled, returns
401 Unauthorizedwith{"detail": {"mfa": true, "mfa_token": "...", "mfa_methods": [...]}}. Proceed to/api/identity/mfa/sendand/api/identity/mfa/verify.
POST
/
api
/
identity
/
token
Authenticate User & Issue JWT Access Token
curl --request POST \
--url https://api.example.com/api/identity/token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data username=auditor.user@telkom.co.id \
--data 'password=SecurePassword2026!'import requests
url = "https://api.example.com/api/identity/token"
payload = {
"username": "auditor.user@telkom.co.id",
"password": "SecurePassword2026!"
}
headers = {"Content-Type": "application/x-www-form-urlencoded"}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({username: 'auditor.user@telkom.co.id', password: 'SecurePassword2026!'})
};
fetch('https://api.example.com/api/identity/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/identity/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "username=auditor.user%40telkom.co.id&password=SecurePassword2026%21",
CURLOPT_HTTPHEADER => [
"Content-Type: application/x-www-form-urlencoded"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/identity/token"
payload := strings.NewReader("username=auditor.user%40telkom.co.id&password=SecurePassword2026%21")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/identity/token")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("username=auditor.user%40telkom.co.id&password=SecurePassword2026%21")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/identity/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "username=auditor.user%40telkom.co.id&password=SecurePassword2026%21"
response = http.request(request)
puts response.read_body{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c3JfMDE4ZjNhNTUiLCJleHAiOjE3MTgwMDAwMDB9.sample_sig",
"refresh_token": "dGhpcy1pcy1hLXNlY3VyZS1yZWZyZXNoLXRva2VuLTIwMjY...",
"token_type": "bearer",
"expires_in": 3600
}{
"detail": {
"mfa": true,
"mfa_token": "mfa_sess_tok_998877aabbcc",
"mfa_methods": [
"email_otp",
"totp"
]
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Headers
Body
application/x-www-form-urlencoded
Response
Login successful without MFA challenge