Skip to main content
All CollectionsKnowledge BaseEndpoint and SaaS AppsTroubleshooting - Endpoint and SaaS Apps
Troubleshooting error - invalid email-id and username or password while executing the script for reporting APIs
Troubleshooting error - invalid email-id and username or password while executing the script for reporting APIs
Updated this week

πŸ“ 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.
ErrorMsg.png

Cause

  • Email address mismatch (case sensitive)

  • Access token for inSync APIs is expired

Resolution

For email address mismatch:

  1. Log on to inSync Management Console.

  2. Go to EndPoint/SaaS apps.

  3. 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:

  1. Log on to inSync Management Console.

  2. Go to EndPoint/SaaS apps.

  3. Go to Settings icon > Endpoints & SaaS Apps Settings.

  4. 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.

Did this answer your question?