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 over 2 months ago

πŸ“ 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 Settings > Access Token tab.

  3. Under Access token for inSync APP, copy the email address displayed against Generated by field.
    ​
    ​

    Settings_AccessToken.png
  4. 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:

  1. Log on to inSync Management Console.

  2. Go to Settings > Access Token tab.
    ​
    ​

    CreateAccessToken.png
  3. Click Create New Token and click Continue on the Create New Token dialogue.This will expire the earlier token.
    ​
    ​

    CreateNewToken1.png
  4. You can optionally set the expiry date and click Create.
    ​
    ​

    CreateNewToken2.png
  5. Copy the newly generated token and replace the access token boldfaced in the script example below:
    ​
    ​

    CreateNewToken3.png


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

Did this answer your question?