Software Distribution

חינם
EPM
על ידי Ivanti | מְעוּדכָּן a year ago | Manage
חזרה לכל ההדרכות (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.