Generate Bearer Token

Prerequisites

  • Have an Azure App Registration

  • Ensure that your Azure App Registration has the API right permission to call SQUID API

  • Generate a Client ID and Client Secret from your Azure App Registration

About

These is many possibility to generate a Bearer Token valid to call SQUID API. You can generate with your own programmatical language or using Postman.

SQUID team provide you some example to generate a bearer token.

 

$uri= "https://login.microsoftonline.com/24139d14-c62c-4c47-8bdd-ce71ea1d50cf/oauth2/v2.0/token"
$clientId     = "<App registration Client ID>"
$clientSecret = "<App registration Client Secret>"
$scope        = "api://f7ef3443-994a-4776-84c4-7285f7250a9d/.default"  # Environmment PREPROD
#$scope        = "api://d3e22197-8595-4742-8f16-1c164d7f3e02/.default" # Environment PRODUCTION
$Body= "grant_type=client_credentials"`
        + "&client_id=" + $clientId`
        + "&client_secret=" + $clientSecret`
        + "&scope=" + $scope`
$Response = Invoke-WebRequest -ContentType "application/x-www-form-urlencoded" -Uri $uri -Method POST -Body $Body
$ResponseJson = $Response | ConvertFrom-Json
$token = $ResponseJson.access_token

 

Select OAuth2.0 and fill the form «Configure new Token»

click on Get new Access Token, a popup will be display to generate a token

Another popup will display the token generated