curl https://idp.talescria.com/oauth/token \
-u "$TALESCRIA_CLIENT_ID:$TALESCRIA_CLIENT_SECRET" \
-d grant_type=client_credentials \
-d "scope=accounts:read payments:write"
import requests
resp = requests.post(
"https://idp.talescria.com/oauth/token",
auth=(client_id, client_secret),
data={"grant_type": "client_credentials", "scope": "accounts:read payments:write"},
timeout=30,
)
token = resp.json()
{
"access_token": "at_test_…",
"refresh_token": "rt_test_…",
"token_type": "Bearer",
"expires_in": 900,
"scope": "accounts:read payments:write"
}
Authentication
Get an access token
Exchange an OAuth client’s credentials for an access token.
POST
/
oauth
/
token
curl https://idp.talescria.com/oauth/token \
-u "$TALESCRIA_CLIENT_ID:$TALESCRIA_CLIENT_SECRET" \
-d grant_type=client_credentials \
-d "scope=accounts:read payments:write"
import requests
resp = requests.post(
"https://idp.talescria.com/oauth/token",
auth=(client_id, client_secret),
data={"grant_type": "client_credentials", "scope": "accounts:read payments:write"},
timeout=30,
)
token = resp.json()
{
"access_token": "at_test_…",
"refresh_token": "rt_test_…",
"token_type": "Bearer",
"expires_in": 900,
"scope": "accounts:read payments:write"
}
Form-encoded (
application/x-www-form-urlencoded). Authenticate the client with HTTP Basic (client_id:client_secret) or with client_id and client_secret in the body, but not both. See Authentication.
Space-separated scopes, to get a token that can do less than its client. Leave it out for all of the client’s scopes.
With
grant_type=refresh_token: the rt_… token from your last token response. Each refresh returns a new one; reusing an old one revokes the whole chain.Response
Errors
Errors follow OAuth 2 ({"error": "invalid_client"}), not the API’s error format.
| Status | error | Meaning |
|---|---|---|
400 | invalid_request | A parameter is missing, or credentials were sent both ways. |
400 | invalid_grant | The refresh token is invalid, expired or already used. |
400 | invalid_scope | A scope doesn’t exist or the client doesn’t hold it. |
400 | unsupported_grant_type | Use client_credentials or refresh_token. |
401 | invalid_client | Unknown client, wrong secret, or a revoked client. |
curl https://idp.talescria.com/oauth/token \
-u "$TALESCRIA_CLIENT_ID:$TALESCRIA_CLIENT_SECRET" \
-d grant_type=client_credentials \
-d "scope=accounts:read payments:write"
import requests
resp = requests.post(
"https://idp.talescria.com/oauth/token",
auth=(client_id, client_secret),
data={"grant_type": "client_credentials", "scope": "accounts:read payments:write"},
timeout=30,
)
token = resp.json()
{
"access_token": "at_test_…",
"refresh_token": "rt_test_…",
"token_type": "Bearer",
"expires_in": 900,
"scope": "accounts:read payments:write"
}