Skip to main content

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

HeaderValueRequiredDescription
Partner-Access-TokenBase64 StringYesIdentifies the partner that owns the provider user.
Content-Typeapplication/jsonYes
Acceptapplication/jsonYes

Payload Parameters

ParameterTypeRequiredDescription
userIdString | IntegerYesStable user identifier supplied by JDB.
usernameStringOptionalDisplay name. A random value is used when omitted.
firstNameStringYesUser first name.
lastNameStringOptionalUser last name.
dateOfBirthStringOptionalDate in YYYY-MM-DD format.
currenciesArray of StringOptionalProvider currency codes, e.g. USD, THB.
phonePrefixStringOptionalDial code such as +66. The leading + is removed when stored.
phoneNumberStringOptionalUser phone number.
emailAddressStringYesValid 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

FieldTypeDescription
expires_atDateTimeToken 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_url is null when the partner has no acsr_domain configured.
  • The token inside redirect_url is encrypted with AES-256-GCM using the partner secret. It is not the same string as data.token.
  • The plain Sanctum token is also returned in the Authorization response header.

Sample Failure Response

{
"result": 0,
"message": "email already exist"
}

An unexpected provider-login failure returns Login failed, please try again later.