Authentication Guide¶
The LAAVAT PKI and Signing Platform uses JSON Web Tokens (JWT) for user and service authentication. This document outlines the methods to obtain JWT tokens programmatically and how to use them in API requests.
JWT tokens must be included in the Authorization header as a Bearer token in API calls. Example:
curl -H "Content-Type: application/json" -H "Authorization: Bearer <JWT_TOKEN>" https://app.laavat.io/<CustomerName>/api/v1/products
Entra ID Authentication¶
Prerequisites¶
- Install the Azure CLI (
az) to use theazcommands. - Obtain the Resource API identifier from your Company IT support. It follows the format:
api://66794fdd-9e05-456e-86cd-a2f990796c48.
Normal User Authentication¶
For interactive authentication, users log in via the Azure CLI.
- Log in to Azure:
Run the following command and provide credentials when prompted:
az login --allow-no-subscriptions - Fetch JWT Token:
Use the following command to obtain a JWT token:
az account get-access-token --resource <Resource_API>- Replace
<Resource_API>with the Resource API identifier provided by your IT support. - Extract the
accessTokenfield from the JSON response for use in API requests.
- Replace
Service Account Authentication¶
For non-interactive scenarios (e.g., CI/CD pipelines), use a Service Principal created in Entra ID.
-
Obtain Credentials:
- Tenant ID: Provided by Company IT support (format:
22794fdd-9e05-456e-86cd-a2f990796c48). - Client ID: Generated when the Service Principal is created.
- Client Secret: Generated when the Service Principal is created.
- Resource API: Provided by Company IT support
- Tenant ID: Provided by Company IT support (format:
-
Fetch JWT Token: Use the following
curlcommand to obtain a JWT token:curl -X POST "https://login.microsoftonline.com/<Tenant_ID>/oauth2/v2.0/token" \ -d "grant_type=client_credentials" \ -d "client_id=<Client_ID>" \ -d "client_secret=<Client_Secret>" \ -d "scope=<Resource_API>/.default"- Replace
<Tenant_ID>,<Client_ID>,<Client_Secret>, and<Resource_API>with the appropriate values. - Extract the
access_tokenfield from the JSON response for use in API requests.
- Replace
Google Authentication¶
Prerequisites for Google¶
- Install the Google Cloud SDK to use the
gcloudcommand. - Obtain the Audience identifier from your Company IT support. It follows the format:
1111154-5435jdfs.apps.googleusercontent.com.
Normal Google User Authentication¶
Using gcloud cli¶
-
Log in via Browser:
gcloud auth login- Login with your credentials in the browser
-
Fetch JWT Token: Use the following command to obtain a JWT token:
gcloud auth print-identity-token- Use the returned token in API requests.
Using the browser and Laavat¶
-
Log in via Browser via LAAVAT PKI and Signing Platform: Navigate to the following URL and authenticate:
https://app.laavat.io/<CustomerName>/api/v1/login- Replace
<CustomerName>with your organization’s identifier.
- Replace
-
Retrieve JWT Token: After authentication, copy the
id_tokenvalue from the response for use in API requests.
Google Service Account Authentication¶
-
Store Credentials: Save the service account credentials to a JSON file (e.g.,
/tmp/googleuser.json). -
Activate Service Account: Run the following command to activate the service account:
gcloud auth activate-service-account --key-file=/tmp/googleuser.json -
Fetch JWT Token: Use the following command to obtain a JWT token:
gcloud auth print-identity-token --audiences="<Audience>"- Replace
<Audience>with the Audience identifier provided by your IT support. - Use the returned token in API requests.
- Replace