Before you start
Ask Lobyco for the authentication configuration of the environment. You receive four values:client_app_id, the application id of the app that represents your service.client_app_secret, its secret. Store it as you store any production secret.client_tenant_id, the id of the tenant that issues the token.lobyco_app_uri, the application id URI of the Lobyco API, which becomes the token scope.
The flow
1
Request a token
Send aPOST to the token endpoint of the Microsoft identity platform, with the four values as form fields:{lobyco_app_uri}.default, whatever roles the app has. A successful response carries the token and its lifetime in seconds:2
Send the token with every call
Put the token in theAuthorization header of each request to a Lobyco API:401 Unauthorized, confirms the credentials. When the token expires, repeat the token request. There is no refresh token in the client credentials flow.Failure and edge cases
When a request is refused, check these first.401 Unauthorizedfrom a Lobyco API means the token is missing, expired or issued for the wrong scope. Check the scope string first.- The token endpoint rejects the request when the app id or the secret is wrong, or the secret has expired. Secrets have an expiry date; ask Lobyco for a new one before it passes.
- Decode a token at jwt.ms to see its claims when a call is refused:
aud,iss,expandroles.
Related
- Multi-tenant authentication using client credentials flow — the same request with an app registered in your own tenant.
- API authentication — how to choose between the two setups, and the API key alternative.