Exchange a signed login challenge for a session
curl --request POST \
--url https://api.example.com/auth/token \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"challengeId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"signature": "<string>",
"publicKey": "<string>"
}
'import requests
url = "https://api.example.com/auth/token"
payload = {
"challengeId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"signature": "<string>",
"publicKey": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
challengeId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
signature: '<string>',
publicKey: '<string>'
})
};
fetch('https://api.example.com/auth/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"accessToken": "<string>",
"refreshToken": "<string>",
"expiresIn": 123,
"userId": "cl_9f2c1ab84d7e4f1fa3c65b0e7d9a2c41"
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}Authentication
Exchange a signed login challenge for a session
Exchange a signed, unexpired challenge for an access token and refresh token. A challenge is consumed once; replay, a different key or a different account is refused.
POST
/
auth
/
token
Exchange a signed login challenge for a session
curl --request POST \
--url https://api.example.com/auth/token \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"challengeId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"signature": "<string>",
"publicKey": "<string>"
}
'import requests
url = "https://api.example.com/auth/token"
payload = {
"challengeId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"signature": "<string>",
"publicKey": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
challengeId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
signature: '<string>',
publicKey: '<string>'
})
};
fetch('https://api.example.com/auth/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"accessToken": "<string>",
"refreshToken": "<string>",
"expiresIn": 123,
"userId": "cl_9f2c1ab84d7e4f1fa3c65b0e7d9a2c41"
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
- ChallengeTokenRequest
- ProofTokenRequest
Response
Successful Response
Short-lived bearer token used to authorize API requests.
Long-lived device-bound token used only at POST /dapi/v1/auth/refresh.
Number of seconds until the access token expires.
Account selected for the issued session.
Pattern:
^(?:cl_)?[A-Za-z0-9._:\-]{1,216}$Example:
"cl_9f2c1ab84d7e4f1fa3c65b0e7d9a2c41"
Was this page helpful?