Software Distribution

GRATIS
EPM
Door Ivanti | Bijgewerkt год назад | Manage
Terug naar alle tutorials (3)

Get the Endpoint Manager access token using PowerShell

Use PowerShell to retrieve the access token from the EPM server so you can use it for API calls. Each call to the API endpoint requires this access token.

$body = @{
  'client_id' = '{YourClientId}'
  'client_secret' = '{YourClientSecret}'
  'grant_type' = 'password'
  'scope' = 'openid'
  'username' = '{YourEPMUser}'
  'password' = '{YourEPMUserPassword}'
}
	
$params = @{
  ContentType = 'application/x-www-form-urlencoded'
  Headers = @{'accept'='application/json'}
  Body = $body
  Method = 'Post'
  Uri = 'https://{YourEPMServer}/my.identityserver/identity/connect/token'
}
	
$token = Invoke-RestMethod @params

With the token saved, add “Bearer {$token}” to the Authorization header in your request.