POST/v2/auth/login

Log in

Exchange an app key and secret for an access token, and set the refresh cookie.

No tokenAuthority: permitAllhttps://user.aerolink.dev

This is the front door. Send the storefront’s appKey and secret. Only a verified, enabled, customer-facing credential that belongs to this storefront’s agency may enter. Staff credentials are refused even if they look valid — this surface is for the shopper API, not the back office.

The Origin header is required and exact. It must be a registered storefront whose role types include CUSTOMER and which has an agency mapped. That agency must be APPROVED, and must not use PLATFORM_COLLECTS settlement.

cURL

bash
curl -X POST https://user.aerolink.dev/v2/auth/login \
  -H "Origin: https://acme.trip963.com" \
  -H "Content-Type: application/json" \
  -d '{"appKey":"ak_live_4f8c2e91d0ab","secret":"••••••••"}'

Headers

Originstring
required

Storefront origin, for example https://acme.trip963.com

Content-Typeapplication/json
required

JSON body

Request

JSON
{
  "appKey": "ak_live_4f8c2e91d0ab",
  "secret": "••••••••"
}

Body fields

appKeystring
required

Storefront application key

secretstring
required

Storefront application secret

Response

200
{
  "message": "Success",
  "data": {
    "accessToken": "eyJhbGciOiJSUzI1NiIs...",
    "expiresIn": 600,
    "user": {
      "id": "68b1...",
      "firstName": "Rahim",
      "lastName": "Uddin",
      "email": "customer@example.com",
      "phoneNumber": "+8801700000000"
    }
  },
  "error": null
}

Response fields

accessTokenstring

Bearer token for every other endpoint

expiresInnumber

Access-token lifetime in seconds

user.idstring

Customer id

user.firstNamestring

Given name

user.lastNamestring

Family name

user.emailstring

Email

user.phoneNumberstring

Phone

Business rules

  • Also sets Set-Cookie: refreshToken=…; HttpOnly and Cache-Control: no-store.
  • A refresh token is stored on the user (capped at 20, oldest evicted).
  • The customer JWT is slim: agency id and country, plus POS for pricing. No agency name, logo or markup.

Errors

400validation failed

appKey or secret missing

403Invalid Credentials

Unknown appKey, wrong secret, not customer-only, or wrong storefront. One generic message so credentials cannot be enumerated.

403Invalid Role

Origin is registered but does not admit CUSTOMER

404Invalid Origin

No Origin header, unregistered origin, no agencyId, agency missing, not APPROVED, or PLATFORM_COLLECTS