Obtaining a Bearer Token
OAuth 2.0 Client Credential Flow
Step 1: Token Request
POST {OAUTH2_TOKEN_ENDPOINT}
Content-Type: application/x-www-form-urlencoded
grant_type=client_credentials&
client_id={your_client_id}&
client_secret={your_client_secret}
Note: You obtain these values from the service account you have created to use with a Billie Connect session.
Step 2: Token Response
{
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "api"
}
Step 3: JWT Token Structure
The returned JWT token contains the following claims:
{
"iss": "authorization-server",
"aud": "billie-connect-api",
"sub": "service-account-id",
"client_no": "7000213",
"account_no": "12345",
"exp": 1640995200,
"iat": 1640991600
}
Implementation Example
# Example token acquisition (reference implementation)
def get_bearer_token(client_id: str, client_secret: str) -> str:
token_url = os.getenv("OAUTH2_TOKEN_ENDPOINT")
payload = {
"grant_type": "client_credentials",
"client_id": client_id,
"client_secret": client_secret
}
response = requests.post(
token_url,
headers={"Content-Type": "application/x-www-form-urlencoded"},
data=payload
)
response.raise_for_status()
return response.json()["access_token"]
OAuth Endpoints to Obtain Bearer Token
|
Incoming Endpoint
|
Region
|
Stage
|
|---|---|---|
https://kauth.ariasystems.net/realms/aria/protocol/openid-connect/token |
US | Prod |
https://kauth.future.stage.ariasystems.net/realms/aria/protocol/openid-connect/token |
US | Future |
https://kauth.current.stage.ariasystems.net/realms/aria/protocol/openid-connect/token |
US | Current |
https://kauth.prod.aus.ariasystems.net/realms/aria/protocol/openid-connect/token |
AUS | Prod |
https://kauth.future.stage.aus.ariasystems.net/realms/aria/protocol/openid-connect/token |
AUS | Future |
https://kauth.current.stage.aus.ariasystems.net/realms/aria/protocol/openid-connect/token |
AUS | Current |
https://kauth.prod.sgp.ariasystems.net/realms/aria/protocol/openid-connect/token |
SGP | Prod |
https://kauth.future.stage.sgp.ariasystems.net/realms/aria/protocol/openid-connect/token |
SGP | Future |
https://kauth.current.stage.sgp.ariasystems.net/realms/aria/protocol/openid-connect/token |
SGP | Current |
https://kauth.cph.ariasystems.net/realms/aria/protocol/openid-connect/token |
CPH | Prod |
https://kauth.future.stage.cph.ariasystems.net/realms/aria/protocol/openid-connect/token |
CPH | Future |
https://kauth.current.stage.cph.ariasystems.net/realms/aria/protocol/openid-connect/token |
CPH | Current |