Authentication#
We use OAuth2 for authorization. You can retrieve an API token using the client credentials flow. The OAuth2 endpoint is available at: https://fleet-api.int.eu-central-1.moia-group.io/auth/oauth/token
Retrieve the API token using the following request providing the credentials using the Authorization header. Replace $CLIENT_ID
and $CLIENT_SECRET
with the credentials provided.
curl \
--location "https://fleet-api.int.eu-central-1.moia-group.io/auth/oauth/token" \
--header "Content-Type: application/x-www-form-urlencoded" \
--user "$CLIENT_ID:$CLIENT_SECRET" \
--data-urlencode "grant_type=client_credentials"
Example output:
{
"access_token": "eyJvcmciOiJk3WZ2dWx0IiwiaWQi0iI2NzA1OGFjZTYxZjc0KzY2OGQyMDk0NWITZjcyNmVlNpIsImgiOiJtdwJtdXIxMjgifQ==",
"expires_in": 3600,
"token_type": "bearer"
}
You will need your <ACCESS_TOKEN>
for all subsequent requests. You can set the token as an environment variable for convenience. Replace <ACCESS_TOKEN>
with the token value you received in the previous step.
export ACCESS_TOKEN=<ACCESS_TOKEN>