Provider Login Endpoint
Creates or updates a JDB provider user for the requesting partner, then returns a Laravel Sanctum token and an optional provider redirect URL.
- Endpoint:
/api/v1/auth/provider-login - Method:
POST - Authentication: Partner token.
Headers
| Header | Value | Required | Description |
|---|---|---|---|
Partner-Access-Token | Base64 String | Yes | Identifies the partner that owns the provider user. |
Content-Type | application/json | Yes | |
Accept | application/json | Yes |
Payload Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
userId | String | Integer | Yes | Stable user identifier supplied by JDB. |
username | String | Optional | Display name. A random value is used when omitted. |
firstName | String | Yes | User first name. |
lastName | String | Optional | User last name. |
dateOfBirth | String | Optional | Date in YYYY-MM-DD format. |
currencies | Array of String | Optional | Provider currency codes, e.g. USD, THB. |
phonePrefix | String | Optional | Dial code such as +66. The leading + is removed when stored. |
phoneNumber | String | Optional | User phone number. |
emailAddress | String | Yes | Valid email address unique within the partner. |
Sample Payload
{
"userId": "JDB-1000123",
"username": "johndoe",
"firstName": "John",
"lastName": "Doe",
"dateOfBirth": "1995-06-15",
"currencies": ["USD", "THB"],
"phonePrefix": "+66",
"phoneNumber": "800000000",
"emailAddress": "user@example.com"
}
Sample Response
{
"result": 1,
"message": "success",
"data": {
"token": "2|sanctum-plain-text-token",
"expires_at": "2026-09-25T08:00:00.000000Z",
"redirect_url": "https://partner.example.com/callback?token=<encrypted-token>"
}
}
Token Metadata
| Field | Type | Description |
|---|---|---|
expires_at | DateTime | Token expiration in ISO 8601 format, set to 30 days after the token is issued. |
Behavior
- A user is matched by partner, provider type, and
userId. - An existing match is updated; otherwise a new active user is created.
redirect_urlisnullwhen the partner has noacsr_domainconfigured.- The token inside
redirect_urlis encrypted with AES-256-GCM using the partner secret. It is not the same string asdata.token. - The plain Sanctum token is also returned in the
Authorizationresponse header.
Sample Failure Response
{
"result": 0,
"message": "email already exist"
}
An unexpected provider-login failure returns Login failed, please try again later.