Skip to content

Authentication

The MLA Service uses Microsoft Entra ID (formerly Azure AD) for authentication. You’ll need to obtain an OAuth 2.0 access token using the Client Credentials flow.

Prerequisites

Before you can authenticate, you’ll need:

  1. Client ID - Your application’s unique identifier
  2. Client Secret - Your application’s secret key
  3. Tenant ID - The Alleviate Azure AD tenant ID
  4. Scope - The API scope for the MLA Service

Obtaining an Access Token

Use the OAuth 2.0 Client Credentials flow to obtain an access token:

Terminal window
curl -X POST "https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials" \
-d "client_id={CLIENT_ID}" \
-d "client_secret={CLIENT_SECRET}" \
-d "scope=api://{DEBT_CORE_APP_ID}/.default"

Token Response

A successful authentication returns:

{
"token_type": "Bearer",
"expires_in": 3599,
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6..."
}
FieldDescription
token_typeAlways “Bearer”
expires_inToken validity in seconds (typically 1 hour)
access_tokenThe JWT token to use for API requests

Using the Access Token

Include the access token in the Authorization header for all API requests:

Terminal window
curl -X POST "https://leads-sandbox.alleviate.com/graphql" \
-H "Authorization: Bearer {ACCESS_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"query":"mutation CreateLead($input: LeadInput!) { createLead(input: $input) { id resultCode } }","variables":{"input":{"firstName":"Test","lastName":"User","dateOfBirth":"1985-06-15","email":"test@example.com","homePhone":"9496779225","address1":"123 Main St","city":"Los Angeles","state":"CA","zipCode":"90001"}}}'

Token Management Best Practices

  1. Cache tokens - Store the token and reuse until expires_in seconds pass
  2. Refresh proactively - Request a new token ~5 minutes before expiration
  3. Handle 401 errors - If you receive a 401, request a new token and retry
  4. Secure storage - Never expose client secrets in client-side code

Required Permissions

Your application must be granted the following permissions:

PermissionTypeDescription
Lead.WriteApplicationCreate and submit leads
Lead.ReadApplicationRead lead status

Troubleshooting

Common Authentication Errors

ErrorCauseSolution
invalid_clientIncorrect client ID or secretVerify your credentials
invalid_scopeWrong scope specifiedUse the correct API scope
unauthorized_clientApp not authorizedContact Alleviate to grant permissions
expired_tokenToken has expiredRequest a new access token

Next Steps

Once you have authentication working:

  1. Review the Environments to select the right endpoint
  2. Follow the Quick Start to make your first API call