Software Distribution

免费
EPM
通过 Ivanti | 已更新 vor einem Jahr | 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.