Skip to main content

Generate Access Token

Berikut adalah proses untuk mendpakan access token

KEYDetail
URLhttps://pg-v2.digitalazhar.id/client/auth/generate-access-token
MethodPOST
Headers
Content-TypeApplication/json
X-CLIENT-KEYCLIENT ID
X-CLIENT-SECRETCLIENT SECRET
Body
grantTypeclient_credentials

CURL Example


curl --location 'https://pg-v2.digitalazhar.id/client/auth/generate-access-token' \
--header 'X-CLIENT-KEY: [CLIENT-ID]' \
--header 'X-SECRET: [CLIENT-SECRET]' \
--header 'Content-Type: application/json' \
--data '{
"grantType": "client_credentials"
}'

Response Example (Success)


{
"success": true,
"code": "SUCCESS",
"message": "Access token created successfully",
"token": "long-token-goes-here",
"token_type": "bearer",
"expires_in": "360"
}

Response Example (Failed)


{
"status": 404,
"message": "Client not found",
"code": "CLIENT_NOT_FOUND",
"errors": [
"Client not found"
]
}