Saviynt unveils its cutting-edge Intelligence Suite products to revolutionize Identity Security!
Click HERE to see how Saviynt Intelligence is transforming the industry.
Saviynt Copilot Icon

Rest API Token Retrieval

bbuchler
New Contributor III
New Contributor III

Hi Team, 

We are trying to grab the access token from our API response, but it does not have a path. IE the body of the response that contains the token is: "TOKEN". We have tried string.content, token, and leaving it blank. I have validated that it works if I grab the token from postman and put it under the accessToken. below is our connection JSON. 

 

{
"authentications":{
"acctAuth":{
"authType":"oauth2",
"httpHeaders":{
"Accept":"application/xml",
"contentType":"application/json"
},
"authError":[
"PASWS013E"
],
"url":"https://<HOSTNAME>/PasswordVault/API/auth/cyberark/Logon",
"httpMethod":"POST",
"httpContentType":"application/json",
"errorPath":"ErrorCode",
"maxRefreshTryCount":5,
"cleanUpTextContent": true,
"tokenResponsePath":"sessionId",
"accessToken":"$access_token",
"httpParams":"{\"username\":\"USERNAME\",\"password\":\"PASSWORD\"}",
"retryFailureStatusCode":[
401,
403
],
"testConnectionParams":{
"http":{
"url":"https://<hostname>/PasswordVault/API/Accounts/?limit=1&access_Token=$access_token",
"httpHeaders":{
"contentType":"application/json"
},
"httpContentType":"application/json",
"httpMethod":"GET"
}
}
}
}
}

To Add I have also tried sessionId from the rest developer handbook.

Thanks,

Brandon 

[This post has been edited by a Moderator to merge two posts.]

16 REPLIES 16

rushikeshvartak
All-Star
All-Star

Please share postman screenshot and curl command [Refer https://codingnconcepts.com/postman/how-to-generate-curl-command-from-postman/ ]


⚠️‼️‼️Do not upload any attachments that contain sensitive information, such as IP Addresses, URLs, Company/Employee Names, Email Addresses, etc.‼️‼️⚠️


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

HI @rushikeshvartak , 

Below is the postman response and curl command. 

bbuchler_2-1717508254836.png

 

bbuchler_1-1717508157677.png

Thanks,

Brandon 

{
"authentications":{
"acctAuth":{
"authType":"oauth2",
"httpHeaders":{
"Accept":"application/xml",
"contentType":"application/json"
},
"authError":[
"PASWS013E"
],
"url":"https://<HOSTNAME>/PasswordVault/API/auth/cyberark/Logon",
"httpMethod":"POST",
"httpContentType":"application/json",
"errorPath":"ErrorCode",
"maxRefreshTryCount":5,
"cleanUpTextContent": true,
"tokenResponsePath":"",
"accessToken":"acc",
"httpParams":"{\"username\":\"USERNAME\",\"password\":\"PASSWORD\"}",
"retryFailureStatusCode":[
401,
403
],
"testConnectionParams":{
"http":{
"url":"https://<hostname>/PasswordVault/API/Accounts/?limit=1&access_Token=$access_token",
"httpHeaders":{
"contentType":"application/json"
},
"httpContentType":"application/json",
"httpMethod":"GET"
}
}
}
}
}


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

Hi @rushikeshvartak 

We have tried leaving the tokenResponsePath blank as above and tried with your JSON. It does not pick up the token. Below is a screenshot from the logs where it is writing acc (accessToken in JSON) as the token in the URL. 

bbuchler_0-1717532333305.png

 

Thanks,

Brandon 

{
"authentications":{
"acctAuth":{
"authType":"oauth2",
"httpHeaders":{
"Accept":"application/xml",
"contentType":"application/json"
},
"authError":[
"PASWS013E"
],
"url":"https://<HOSTNAME>/PasswordVault/API/auth/cyberark/Logon",
"httpMethod":"POST",
"httpContentType":"application/json",
"errorPath":"ErrorCode",
"maxRefreshTryCount":5,
"cleanUpTextContent": true,
"tokenResponsePath":"string.content",
"accessToken":"acc",
"httpParams":"{\"username\":\"USERNAME\",\"password\":\"PASSWORD\"}",
"retryFailureStatusCode":[
401,
403
],
"testConnectionParams":{
"http":{
"url":"https://<hostname>/PasswordVault/API/Accounts/?limit=1&access_Token=$access_token",
"httpHeaders":{
"contentType":"application/json"
},
"httpContentType":"application/json",
"httpMethod":"GET"
}
}
}
}
}


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

Hi @rushikeshvartak , 

Same as above please see the below screenshot. 

bbuchler_0-1717589949555.png

Thanks,

Brandon 

Remove test connection param and validate


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

Hi @rushikeshvartak , 

Jobs did not work. First screenshot is with string.content second it is left empty (for variable tokenResponsePath). 

bbuchler_1-1717591817936.png

bbuchler_2-1717591941231.png

Thanks,

Brandon 

Above suggested json is from documentation 


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

Hi @rushikeshvartak , 

Yes, that is what we found as well. This seems to be an issue with Saviynt picking up the token if you don't have any other suggestions I will create a FD ticket. 

Thanks,

Brandon 

Add feedback on saviynt doc they will provide working json


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

@rushikeshvartak Thank you I will try that first. 

Refer https://forums.saviynt.com/t5/identity-governance/access-token-refresh-failure-issue-cyberark-target...


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

Hi @rushikeshvartak , 

This forums post looks to be similar to this one and they said that it is not working for the account imports. 
Solved: Generate token using cookie in responseText (Conne... - Saviynt Forums - 74310

Thanks,

Brandon 

Did you tried this one ? @bbuchler 


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

@rushikeshvartak , 

 

No, we have not tried this one since our use cases are for imports which in the post states it does not work for that. 

 

Thanks,

Brandon