Keep getting "PASWS006E: The session token is missing, invalid or expired" when trying to use API.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Keep getting "PASWS006E: The session token is missing, invalid or expired" when trying to use API.

L1 Bithead

I made use of the CyberArk API for Privilege Cloud before it was integrated with CyberArk Identity. Now I keep getting "PASWS006E: The session token is missing, invalid or expired"

My code looks like:

$uri = https://<identity-tenant-id>.id.cyberark.cloud/oauth2/platformtoken

$headers = new-object "System.Collections.Generic.Dictionary[[String],[String]]"

$headers.add("Content_type", "x-www-form-urlencoded")

$body = 'grant_type=client_credentials&client_id=<client_id>&client_secret=<client_secret>'

$capture = Invoke-RestMethod -Uri $uri -Method 'POST' -Headers $headers -Body $body

$token = $capture.access_token

 

$uri = 'https://<subdomain>.privilegecloud.cyberark.cloud/PasswordVault/<API>'

$headers = new-object "System.Collections.Generic.Dictionary[[String],[String]]"

$headers.add("Authorization", $token)                            

$headers.add("content-type", "application/json")                

$body = <body>

$capture = Invoke-WebRequest -Uri $uri -Method 'POST' -Headers $headers -Body $body

 

I have repeatedly confirmed that the first block succeeds and $token will get assigned a long string of various characters. The user being authenticated in the first block exists in CyberArk Identity, has the "Is Service user" and "Is OAuth confidential client" boxes checked. The user has the Privilege Cloud User Role and another Role which has access to a Safe. I have tried using Postman. Again, I can get a token value, and I set that as the value for an Authorization header. The result is the same.

 

The other thing I want to call out, is there is a step "Assign the newly created Service user(s) to the your service role that enables them to send requests to your service APIs". I am not sure what Role this is referencing. I did not see an API role nor any API options when creating a new role.

 

Reference material: https://docs.cyberark.com/Product-Doc/OnlineHelp/PrivCloud-SS/Latest/en/Content/ISPSS/ISPSS-API-Authentication.htm

4 REPLIES 4

L6 Presenter

This honestly looks good to me after a quick review. I believe the 'role assignment' you saw in the Docs is referring to the Privilege Cloud roles as you've already configured them.

 

Since you're getting the token from Identity I'm mostly curious if the Privilege Cloud API syntax is correct. Of course the error you are receiving is telling me it is at least 'mostly' correct, otherwise we would be seeing bad requests. Are you able to message me the full API path and/or body of that request for a quick review?

L1 Bithead

I would be willing to, but how do I send you a message? I don't see an option under Messages nor do I see a send message button when I go to your profile. Understandably, I am unwilling to post that information here.

L3 Networker

Hi Nate, if you haven't already done so, I would encourage you to open a new case with our Support Team. After reviewing other support cases in which the same error message was encountered, I see that there are many factors that come into play and our Support Engineers would be happy to lend a hand with the linear troubleshooting process you've begun.

 

-Sal

L1 Bithead

Can you share anything about how you resolved this? I am having the same issue.

  • 2007 Views
  • 4 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!