Skip to main content
In the Lobyco tenant setup, Lobyco registers the app that represents your service in its own Azure AD tenant and shares the credentials with you. There is nothing to set up in a directory on your side. This page is the token request your backend makes, and how it uses the token. The same request serves the multi-tenant setup, with your own tenant id.

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 a POST to the token endpoint of the Microsoft identity platform, with the four values as form fields:
The scope is always {lobyco_app_uri}.default, whatever roles the app has. A successful response carries the token and its lifetime in seconds:
Lobyco recommends the Microsoft Authentication Library (MSAL) over the raw request, because it caches the token and renews it before it expires.
2

Send the token with every call

Put the token in the Authorization header of each request to a Lobyco API:
A normal response from the first call, not 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 Unauthorized from 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, exp and roles.
Last modified on October 19, 2026