and more in a single search tool across platforms. Read the announcement here. |
02/06/2024 02:53 PM
Hi,
I am facing an issue mapping the authentication token in the ConnectionJSON for REST connector.
The token is generated from a basic logon API using username and password.
Below is the Postman response to the logon request. The token is shared in the body of the response in plain text:
Below is the Saviynt logs showing the token in the "responseText" field:
I need to map the value in "responseText" to my token in the ConnectionJSON.
Then I need to pass the token in the httpHeaders for other JSONs (ex: CreateAccount, UpdateAccount, etc.)
How can I achieve this mapping in the ConnectionJSON?
Below is my current ConnectionJSON and CreateAccountJSON.
ConnectionJSON:
{
"authentications": {
"userAuth": {
"authType": "Basic",
"url": "xxxxx",
"httpMethod": "POST",
"httpParams": {},
"httpHeaders": {},
"httpContentType": "text/html",
"properties": {
"userName":"xxxxx",
"password":"xxxxx"
},
"expiryError": "ExpiredAuthenticationToken",
"authError": [
"InvalidAuthenticationToken",
"Couldn’t aunthenticate you",
"AuthenticationFailed"
],
"timeOutError": "Read timed out",
"errorPath": "error.code",
"maxRefreshTryCount": 5,
"tokenResponsePath": "responseText",
}
}
}
CreateAccountJSON:
{
"accountIdPath": "accountName",
"responseColsToPropsMap": {},
"call": [
{
"name": "call1",
"connection": "userAuth",
"url": "xxxxxxx",
"httpMethod": "POST",
"httpParams": "{xxxxx}",
"httpHeaders": {
"Cookie": "${responseText}"
},
"httpContentType": "application/json",
"successResponses": {
"Status": "SUCCESS"
}
}
]
}
Solved! Go to Solution.
02/06/2024 03:29 PM - edited 02/06/2024 03:29 PM
Can you share postman screenshot for create account api to see body parameters
Please share curl command [Refer https://codingnconcepts.com/postman/how-to-generate-curl-command-from-postman/ ]
02/07/2024 06:18 AM
Hi Rushikesh,
Body for create user request in Postman is below. Blanked out is simply the attribute map in JSON format.
And the curl command is below.
I need to get the responseText from connectionJSON to map to the "Cookie" used in the header for this request.
Thanks.
02/13/2024 09:10 AM
Hi Rushikesh,
I have shared the information you requested. Do you have any suggestions for resolving this issue?
Thanks.
02/13/2024 07:30 PM
Establish connection in create account json and try instead of connection json
02/14/2024 06:13 AM
Thanks Rushikesh,
Do you have any sample JSON or format on how to establish connection in the CreateAccountJSON directly?
02/14/2024 07:15 AM
Refer https://docs.saviyntcloud.com/bundle/Dev-Handbook-REST-v24x/page/Content/Developers-Handbook.htm
02/15/2024 03:46 AM - edited 02/15/2024 04:44 AM
Is there a way to mask credentials when using connection parameters in CRUD jsons?
Got , it . We can refer it dynamically from connection.
02/07/2024 10:05 PM
Is this a valid token response? Since it returns in plaintext and not in json format?
02/08/2024 07:58 AM
This is what I need an answer to. And if the response is valid, how do I map the token response in Saviynt, so that I can pass the token in other JSONs?
04/17/2024 07:18 AM
We have a solution which involves establishing the connection directly in the Create, Update, and Remove Account JSONs (connection properties masked), then mapping the token response from the connection to the subsequent Create/Update/Delete API request call.
Please find examples below. Also note, this is NOT working the same for the ImportAccountEntJSON. This solution is working in the Create, Update, and Remove Account JSONs.
Sample Create Account JSON:
{
"accountIdPath": "accountName",
"responseColsToPropsMap": {},
"call": [
{
"name": "call1",
"connection": "acctAuth",
"url": "<url>",
"httpMethod": "POST",
"httpHeaders": {
"Content-Type": "application/x-www-form-urlencoded"
},
"httpParams": "{\"userid\":\"${connection.properties.userName}\",\"password\":\"${connection.properties.password}\"}",
"httpContentType": "application/x-www-form-urlencoded",
"successResponses": {
"statusCode": [
200,
201
]
}
},
{
"name": "call2",
"connection": "acctAuth",
"url": "<url>",
"httpMethod": "POST",
"httpParams": "{\"createUser\":{\"<attr1>\":\"${<attr1mapping}\"}}",
"httpHeaders": {
"Cookie": "${response.call1.message.responseMessage}"
},
"httpContentType": "application/json",
"successResponses": {
"userStatus": "PROVISIONED"
}
}
]
}