Get OAuth2 token
POST
/idp/oauth2/token
Issues OAuth2 tokens used to authenticate every API call. The security foundation of the platform.
Supports four flows depending on the integration type:
client_credentials— server-to-server access to the Zertiban API. TheclientId/clientSecretpair travels in theAuthorizationheader as HTTP Basic, not in the body. Returns a short-livedaccess_token(defaultexpires_inis 900 seconds / 15 minutes). Send it on every subsequent API call asAuthorization: Bearer {access_token}, alongsidex-tenant-id: {businessUuid}.authorization_code+ PKCE — browser-driven login for the Zertiban dashboard.refresh_token— exchange a refresh token for a new access token (typically for the dashboard session).urn:ietf:params:oauth:grant-type:token-exchange— tenant-to-tenant switch within the same user session. The dashboard sends the currentaccess_tokenassubject_tokenand the target tenant UUID asaudience. Returns a newaccess_tokenwith the roles and authorities of the target tenant. The original token is not revoked. Thescopeandresourceparameters are not accepted and will produce a400 invalid_request.urn:ietf:params:oauth:grant-type:token-exchange(delegated, org-to-org) — a collaborator M2M client exchanges its ownclient_credentialsaccess token for a new access token acting on behalf of a client organisation. The collaborator sends its ownaccess_tokenassubject_tokenand the target organisation UUID astarget_tenant(instead ofaudience). Returns a newaccess_tokenwhosesubandtenant_idare the target organisation, carrying anactclaim that identifies the collaborator. Requires an existing mandate between the two organisations; otherwise the request is rejected with400 invalid_grant.
Always read expires_in from the response and refresh before expiry to avoid 401 errors.
Autorizaciones
clientSecretBasic
OAuth2 client authentication for the token endpoint. The
clientId / clientSecret pair is sent as HTTP Basic Auth in
the Authorization header (e.g. curl -u clientId:clientSecret,
Python requests auth=(id, secret)), not in the request body.
Required by default for confidential clients.
Tipo
HTTP (basic)
Cuerpo de la petición
application/x-www-form-urlencoded
JSON "grant_type": "client_credentials", "scope": "openid profile api"
{
}
Respuestas
Token response
application/json
JSON "access_token": "string", "token_type": "Bearer", "expires_in": 900, "refresh_token": "string", "scope": "string", "id_token": "string", "issued_token_type": "string", "additionalProperties": "string"
{
}