π 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 Settings > Access Token tab.
Under Access token for inSync APP, copy the email address displayed against Generated by field.
β
β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:
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
For expired access token:
Log on to inSync Management Console.
Go to Settings > Access Token tab.
β
βClick Create New Token and click Continue on the Create New Token dialogue.This will expire the earlier token.
β
βYou can optionally set the expiry date and click Create.
β
β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 if you can successfully execute the PowerShell command.