Exchange client credentials for a short-lived, scoped bearer token
curl --request POST \
--url https://sandbox.composer.id/v1/oauth/token \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data grant_type=client_credentialsimport requests
url = "https://sandbox.composer.id/v1/oauth/token"
payload = { "grant_type": "client_credentials" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/x-www-form-urlencoded"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'Content-Type': 'application/x-www-form-urlencoded'
},
body: new URLSearchParams({grant_type: 'client_credentials'})
};
fetch('https://sandbox.composer.id/v1/oauth/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"access_token": "<string>",
"token_type": "Bearer",
"expires_in": 123,
"scope": "<string>"
}{
"error": "invalid_request",
"error_description": "<string>"
}{
"error": "invalid_request",
"error_description": "<string>"
}Exchange client credentials for a short-lived, scoped bearer token
RFC 6749 section 4.4. Send grant_type=client_credentials with the client id and secret as HTTP Basic credentials (or in the body), optionally narrowing scope. The response is not cacheable. Tokens expire after expires_in seconds; request a new one on 401.
POST
/
oauth
/
token
Exchange client credentials for a short-lived, scoped bearer token
curl --request POST \
--url https://sandbox.composer.id/v1/oauth/token \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data grant_type=client_credentialsimport requests
url = "https://sandbox.composer.id/v1/oauth/token"
payload = { "grant_type": "client_credentials" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/x-www-form-urlencoded"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'Content-Type': 'application/x-www-form-urlencoded'
},
body: new URLSearchParams({grant_type: 'client_credentials'})
};
fetch('https://sandbox.composer.id/v1/oauth/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"access_token": "<string>",
"token_type": "Bearer",
"expires_in": 123,
"scope": "<string>"
}{
"error": "invalid_request",
"error_description": "<string>"
}{
"error": "invalid_request",
"error_description": "<string>"
}Authorizations
Body
application/x-www-form-urlencodedapplication/json
OAuth 2.0 client-credentials grant. Client id and secret go in an HTTP Basic Authorization header (preferred) or in these fields.