Getting Access Token (Azure)¶
This guide explains how to authenticate against the ODM API protected by Azure AD using a Bearer token. We’ll walk through installing the Azure CLI, obtaining the token, and then passing it in request headers.
0. Prerequisites¶
Before starting, ensure you have the following:
-
Azure CLI installed
Follow the official installation guide: 👉 Install the Azure CLI -
Application ID required for login
It identifies the registered application you're requesting a token for.
It is recommended to get this ID from your ODM Administrator.
1. Login to Azure with Required Scope¶
Run the following command to log in with your Application (Client) ID scope:
- A browser window will open to complete the login.
- Select the appropriate tenant (if prompted).
- Once logged in, Azure CLI will establish a session with the provided scope.
2. Retrieve an Access Token¶
After logging in, request an access token with:
This will return a long JWT string (the Bearer token), for example:
⚠️ The token is valid for a limited time (usually 1 hour). You will need to refresh it when expired.
3. Use the Bearer Token in ODM API Calls¶
Pass the token in the Authorization header when making ODM API requests.
Here’s an example using curl:
curl -X GET \
"https://<ODM_HOST>/api/v1/as-user/studies" \
-H "accept: application/json" \
-H "Authorization: Bearer <YOUR_ACCESS_TOKEN>"
Replace <ODM_HOST> with the actual ODM address, <YOUR_ACCESS_TOKEN> with the value returned from the previous step.
If authentication is successful, you’ll receive a valid JSON response from the API. Example: