π Note
βThis article applies to
OS: Windows OS running PowerShell
Product edition: inSync Cloud
Problem description
The following error is displayed on running the script to generate the API reports:
Invalid email-id/username or password.
Cause
Email address mismatch (case sensitive)
Access token for inSync APIs is expired
Resolution
For email address mismatch:
Log on to inSync Management Console.
Go to EndPoint/SaaS apps.
Go to Settings icon > Endpoints & SaaS Apps Settings.
4. Under Access Token for Endpoints & Saas Apps APIs, copy the email address displayed against Generated by field.
5. Replace the <username> in the script with the email address copied in the earlier step.
For example, you need to replace the <username> in bold text in the code snippet below:β
$secpasswd = ConvertTo-SecureString "<Access-Token>" -AsPlainText -Force
$Cred = New-Object System.Management.Automation.PSCredential (' <username> β, $secpasswd) $user = Invoke-RestMethod -Method 'Get' -uri "https://<On-prem-Master-FQDN-OR-IP:port>/api/reports/v1/users" -Credential $Cred
For expired access token:
Log on to inSync Management Console.
Go to EndPoint/SaaS apps.
Go to Settings icon > Endpoints & SaaS Apps Settings.
Under Access Token for Endpoints & Saas Apps APIs
5. Click Create New Token and click Continue on the Create New Token dialogue. This will expire the existing token.
6. You can optionally set the expiry date and click Create New Token.
7. Copy the newly generated token and replace the access token boldfaced in the script example below:
Example:
$secpasswd = ConvertTo-SecureString " <Access-Token> " -AsPlainText -Force $Cred = New-Object System.Management.Automation.PSCredential ('<username>β, $secpasswd) $user = Invoke-RestMethod -Method 'Get' -uri "https://<On-prem-Master-FQDN-OR-IP:port>/api/reports/v1/users" -Credential $Cred
Verification
Verify that you can successfully execute the PowerShell command.