Skip to main content

OAuth 2.0 API Introduction

Introduction

Purpose

This specification defines the authentication and authorization protocol used between the Requestor and the Issuer for real-time transaction authorization.

The protocol is based on OAuth 2.0 using the Client Credentials Grant with private_key_jwt client authentication. Authorization requests and responses are protected end-to-end using JSON Web Encryption (JWE).

This specification defines the protocol contract only. Implementation details (frameworks, code, deployment) are outside the scope of this document.

Throughout this document the keywords MUST, SHOULD and MAY are to be interpreted as described in RFC 2119. All concrete values — domains, identifiers, keys, card numbers, amounts and timestamps — are illustrative examples only and do not constitute agreed values or a contract.

Terminology

TermDescription
IssuerOAuth Authorization Server and Resource Server; authorization decision authority
RequestorOAuth Client invoking the Authorization API
Access TokenJWT (JWS, ES256) issued by the Issuer
Client AssertionJWT used to authenticate the Requestor (private_key_jwt)
JWK / JWKSJSON Web Key / JSON Web Key Set
JWSJSON Web Signature
JWEJSON Web Encryption

Supported Standards

StandardDescription
RFC 6749OAuth 2.0 Authorization Framework
RFC 7515JSON Web Signature (JWS)
RFC 7516JSON Web Encryption (JWE)
RFC 7517JSON Web Key (JWK)
RFC 7518JSON Web Algorithms (JWA)
RFC 7519JSON Web Token (JWT)
RFC 7523JWT Profile for OAuth 2.0 Client Authentication

Protocol Flow

Requestor
| 1. Request access token (client_credentials + private_key_jwt)
v
Issuer Token Endpoint
| 2. JWT access token (ES256)
v
Requestor
| 3. POST Authorization API
| Authorization: Bearer <token>
| Body: JWE (encrypted with Issuer RSA public key)
v
Issuer
| - Validate access token
| - Decrypt request
| - Process authorization decision
| - Encrypt response (with Requestor RSA public key)
v
Requestor (decrypts JWE response)

Endpoints

Token Endpoint

POST /oauth2/token
Content-Type: application/x-www-form-urlencoded

Purpose: issue an OAuth 2.0 access token. The Requestor authenticates with private_key_jwt (no client_secret).

Request parameters:

ParameterRequiredValue / Notes
client_idYesoob-client
grant_typeYesclient_credentials
scopeYesSTART_OOB/ CHECK_OOB
client_assertion_typeYesurn:ietf:params:oauth:client-assertion-type:jwt-bearer
client_assertionYesSigned ES256 JWT (see §6)

Example (illustrative):

client_id=oob-client
grant_type=client_credentials
scope=START_OOB+CHECK_OOB
client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer
client_assertion=<signed_jwt>

JWKS Endpoint

GET /.well-known/jwks.json

Purpose: expose the Issuer public keys. The endpoint MUST publish:

  1. EC signing public key — used by the Requestor to verify the access token.
  2. RSA encryption public key — used by the Requestor to encrypt the authorization request.

Each published JWK MUST carry a kid matching the kid used in the corresponding JWS/JWE header.

Client Authentication (private_key_jwt)

The Requestor MUST authenticate using OAuth 2.0 private_key_jwt (RFC 7523). The client_assertion is a JWT signed with the Requestor's EC private key (ES256).

JWT Header

{
"alg": "ES256",
"typ": "JWT",
"kid": "requestor-key-01"
}

Required Claims

ClaimRequiredConstraint
issYesMUST equal client_id
subYesMUST equal client_id
audYesMUST equal the token endpoint URL
expYesShort-lived; SHOULD be ≤ 5 minutes after iat
iatYesIssued-at time
jtiYesUnique; MUST NOT be reused (replay protection)

The Issuer MUST reject an assertion failing signature verification, any claim constraint, or a clock skew greater than ±5 minutes.

Access Token

The Issuer MUST issue a JWT access token signed with its EC private key (ES256). Header carries alg=ES256 and the Issuer signing kid.

Required Claims

ClaimDescription
issIssuer identifier
subClient identifier
audAuthorization API audience
scopeAuthorized scope (ACS)
iatIssued-at time
expExpiration time

Token response example (illustrative):

{
"access_token": "eyJhbGciOiJFUzI1NiIs...",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "ACS"
}

Key Distribution

Both parties exchange only public keys; private keys MUST NEVER be exposed.

KeyOwnerUsed byPurposeDistribution
EC publicIssuerRequestorVerify access tokenIssuer JWKS
RSA publicIssuerRequestorEncrypt requestIssuer JWKS
EC publicRequestorIssuerVerify client_assertionRegistration / Requestor JWKS
RSA publicRequestorIssuerEncrypt responseRegistration / Requestor JWKS

OAuth Error Responses

Token Endpoint

Per RFC 6749 §5.2, all token-endpoint errors return HTTP 400 except invalid_client, which returns HTTP 401.

HTTPErrorMeaning
400invalid_requestMalformed or missing parameters
400invalid_grantInvalid / expired client_assertion
400invalid_scopeRequested scope not allowed
401invalid_clientClient authentication failed

Example (illustrative):

{
"error": "invalid_client"
}

Security Requirements

Transport

  1. HTTPS is mandatory; TLS 1.2 or later MUST be supported.

Replay Protection

The Issuer MUST validate:

  1. jti uniqueness (reject duplicates).

Access Token Validation

Before processing a request, the Issuer MUST validate the access token: JWT signature, issuer, audience, expiration and scope.

Key Management

  1. Public keys distributed via the JWKS endpoint(s); private keys never exposed.
  2. Private keys SHOULD be stored in an HSM/KMS and rotated periodically (e.g. every 90 days).
  3. RSA keys MUST be ≥ 2048-bit.

Supported Algorithms

UsageAlgorithm
JWS signature (access token, client_assertion)ES256
JWE key managementRSA-OAEP-256
JWE content encryptionA128GCM

Conformance

A conforming implementation MUST:

  1. Support the OAuth 2.0 Client Credentials Grant.
  2. Support private_key_jwt client authentication (ES256).
  3. Issue and validate JWT access tokens (ES256).
  4. Expose public keys via JWKS.
  5. Support JWE Compact Serialization for requests and responses.
  6. Encrypt requests to the Issuer RSA public key and responses to the Requestor RSA public key (RSA-OAEP-256 + A128GCM).
  7. Enforce replay protection (jti).
  8. Validate all mandatory security requirements in §12.

API List

No.ModuleAPI NameAPI DescriptionPrepaidDebitRemark
1ApplicationCardApplicationSupport both Physical / virtual card application (delivery address is mandatory for Physical card)MM
2CustomerCustomerCardInfoInquiryReturn the card information (including card status) with inquiry of the customer idMM
3CustomerAccountInfoInquiryReturn the account information (including account status) with inquiry of the customer idONA
4CustomerInfoUpdateFor customer Information maintenance, including mobile number, email address, address (delivery address for physical card)…OO
5AccountAccountLinkageAssociate a card with an accountOO
6AccountStatusUpdateChange Account Status including block, close etc.ONA
7CardCardInfoInquiryReturn card information, card plastic status and status date, renew/reissuing information and other card-related informationOO
8CardActivationActivate a cardOO
9
10CardReplacementSupport Card Replacement with Same Card number or Specific card number or Random card number; Also can be used to convert virtual card to physical cardOO
11CardCancellationCard Cancellation with reason codes or memoOO
12CardStatusUpdateChange Card Status including lost, stolen, block etc.CC
13CardLimitSettingSet transaction limit + Domestic/Oversea & e-commerce/POS Transaction IndicatorOOCard level limit control
14CardCVV2InquiryRetrieve Card number, expiry date, CVV2 by card tokenONAOnly for virtual card
15CardCVV2VerifyVerify CVV2 by card tokenONAOnly for virtual card
16GenerateDCVVGenerate a new CVV2OO
17CardExpiryDateUpdateUpdate Card Expiry DateNA
18CardSecureRegist3D-Secure Service for cardholder. if registered, the cardholder will get OTP by mail /SMS when e-commerce transaction need authenticationOOIf use Coshine’s ACS Services
19BlacklistUpdateInsert or delete blacklist or whitelist cardNANAOld Version. Not used now.
20PINResetReset Card PINOMIf card support online PIN
21PINChangeChange Card PINOM
22PINVerifyVerify Card PINOO
23TransactionBalanceInquiryBalance InquiryONAWallet / Banking system will provide their own API if account is controlled by their system
24LoadFundLoad fund / Payment to card accountONA
25WithdrawWithdraw in ATMCNAIf prepaid card support ATM transaction
26TransferFundTransfer between two cardONA
27PurchasePurchase /Sale transactionCNA
28RefundRefund or Void transactionCNA
29ReversalReversal for LoadFund , Withdraw, TransferFund and PurchaseMNA
30BlockFundFor Preauthorization or other purpose to block the amountCNAIf prepaid card support pre-auth / block fund
31UnblockFundRelease/ Partial release preauthorizationCNA
32ServiceChargeService Fee chargeONA
33VerificationCard/Account VerificationONA
34DebitAdjustmentDebit Adjustment (Miscellaneous adjustment with memo)ONA
35CreditAdjustmentCredit Adjustment (Miscellaneous adjustment with memo)ONA
36TransactionHistoryInquiry Transaction History by token numberMNA
37AuthorizationHistoryInquiry Authorization History by token numberONA
38TokenTokenInquiryInquiry token information by card number.
39TokenRequestAfter Generated UnionPay Virtual PAN based on issuer’s mobile APP Account, initialize Token for the Virtual PAN.
40TokenStateUpdateWhen the Cardholder or the mobile application suspends, resumes, or deletes the card, the mobile application shall send the Token State Update request to change the state of the Token.
41TokenStateNotificationWhen the UMPS suspends, resumes, or deletes the card, the UMPS will send the Token State Notification request to notify the mobile application.
42TokenMetadataUpdateThe Token metadata, e.g., Token expiry date, needs to be updated from the mobile application’s side if the PAN expiry date has already been renewed.
43ReplenishTokenLUKMobile application will call SDK API “tokenValidForProcessing” to check if there are available LUKs in SDK before payment for a given Token identified by the Token ID
44AuthenticationSendOTPDirect OTP authentication request to issuer
45VerifyOTPRequest to verify the OTP provided
46StartOOBAuthenDirect OOB authentication request to issuer
47OOBResultInquiryInquiry the result of OOB authentication
48ParameterDropDownListInquiryRetrieve lookup table from our system, such as reason list for card replacement