Click HERE to see how Saviynt Intelligence is transforming the industry. |
04/24/2024 06:38 AM
Hi All,
Below is the JSON we are using for connection JSON for Rest Connector. We are using basic authentication. We checked in postman it works fine. Please let me know what the issue in below JSON is. In logs getting 400 . In pending task error for create account is "headers":null,"message":{"Message":"A valid session is required for API access.","StackTrace":null},"statusCode":400,"description":null,"status":"Failed"}}.
Connection JSON:
{
"authentications":{
"acctAuth":{
"authType":"Basic",
"url":"https://xxxxxxx/Login",
"httpMethod":"POST",
"httpParams":{
},
"httpHeaders":{
},
"httpContentType":"application/json",
"properties":{
"userName":"xx",
"password":"xxx"
},
"authError":[
"InvalidAuthenticationToken",
"Couldn’t aunthenticate you",
"AuthenticationFailed"
],
"errorPath":"error",
"retryFailureStatusCode":[
401
],
"maxRefreshTryCount":5,
"tokenType":"Basic",
"accessToken":"Basic abcd"
}
}
}
In Postman we give below json
In Body / JSON
Solved! Go to Solution.
04/24/2024 11:24 AM
@kmashwini : in Postman call what is the Authorization you are sending in Header?
Try below JSON
{
"authentications": {
"acctAuth": {
"authType": "Basic",
"url": "https://xxxxxxx/Login",
"httpMethod": "POST",
"httpParams": {
"userName": "xxxxxx",
"password": "xxxxx"
},
"httpHeaders": {
"Authorization": "Basic xxxxx",
"contentType": "application/json"
},
"httpContentType": "application/json",
"authError": [
"InvalidAuthenticationToken",
"Couldn’t aunthenticate you",
"AuthenticationFailed"
],
"errorPath": "error",
"retryFailureStatusCode": [
401
],
"maxRefreshTryCount": 5,
"tokenType": "Basic",
"accessToken": "Basic abcd"
}
}
}
04/25/2024 12:39 AM
@Saathvik I am not sending anything in headers , Authorization is there with autogenerated.
04/25/2024 01:21 AM
I have tried above JSON which u mentioned but still getting same error. which is 400 .
04/24/2024 08:26 PM
Please share curl command [Refer https://codingnconcepts.com/postman/how-to-generate-curl-command-from-postman/ ]
04/25/2024 05:46 AM
04/25/2024 05:58 AM
I have tried below json also , since we are receiving cookie in headers.
{
This is from Saviynt Logs
"authentications":{
"acctAuth":{
"authType":"Basic",
"url":"xx",
"httpMethod":"POST",
"httpParams":{
},
"properties":{
"userName":"xx",
"password":"xx"
},
"httpHeaders":{
"Content-Type":"application/json"
},
"httpContentType":"application/json",
"expiryError":"ExpiredAuthenticationToken",
"authError":[
"USER_AUTHENTICATION_FAILED"
],
"timeOutError":"error",
"errorPath":"error",
"maxRefreshTryCount":3,
"tokenResponsePath":"#HEADERS#Set-Cookie",
"tokenType":"",
"authHeaderName":"Cookie",
"retryFailureStatusCode":[
401
],
"accessToken":"sdfghjk",
"testConnectionParams":{
"http":{
"url":"xxxx",
"httpHeaders":{
"Content-Type":"application/json"
},
"properties":{
"userName":"xxx",
"password":"xxx"
},
"httpContentType":"application/json",
"httpMethod":"POST"
},
"successResponse":[
],
"successResponsePath":"responseText",
"errorPath":"responseText",
"retryFailureStatusCode":[
401
]
}
}
}
}
Below is the postman, we are not sending anything in params . Cookie is autogenerated in headers and we receive true as response.
04/25/2024 06:51 AM
@kmashwini : Please change the "authHeaderName":"Cookie" to "authHeaderName":"Authorization" and check. Also can you please share the curl command of subsequent call you are using in testConnectionParams? I don't think you have to explicitly pass username/password again in testconnection block
04/25/2024 06:59 AM - edited 04/25/2024 07:08 AM
In cookie we are getting access token , if we give authorization how it would work . I changed and checked still shows same error .Also we dont have curl command .
04/25/2024 07:17 AM - edited 04/25/2024 07:17 AM
In cookie we are getting two values as response in postman but in Saviynt I could see only one. How to map this in JSON
04/25/2024 09:01 PM
{
"authentications": {
"acctAuth": {
"authType": "oauth2",
"url": "URL",
"httpMethod": "POST",
"httpParams": {
"username": "rushi",
"password": "xxxxxx"
},
"httpContentType": "application/x-www-form-urlencoded",
"successResponse": [
200
],
"maxRefreshTryCount": 1,
"retryFailureStatusCode": [401,400,403,404,500,502,503],
"tokenResponsePath": "#HEADERS#Set-Cookie",
"tokenType": "",
"authHeaderName": "Cookie",
"access_token": "NGSecure abc"
}
}
}
Use above JSON
04/26/2024 01:09 AM
The above JSON also not working, getting same error as 400 in logs
04/26/2024 12:50 PM
Please share logs
04/30/2024 06:10 AM - last edited on 04/30/2024 08:19 AM by Sunil
The below is the JSON we are trying, we are getting cookie in logs but still says 400 as error.
JSON:
{
"authentications":{
"acctAuth":{
"authType":"oauth2",
"url":xxx,
"httpMethod":"POST",
"httpParams":{
},
"properties":{
"userName":"xxx",
"password":"xxxx"
},
"httpHeaders":{
"Content-Type":"application/json"
},
"httpContentType":"application/json",
"expiryError":"ExpiredAuthenticationToken",
"authError":[
"USER_AUTHENTICATION_FAILED",
"false"
],
"timeOutError":"error",
"errorPath":"error",
"maxRefreshTryCount":3,
"tokenResponsePath":"#HEADERS#Set-Cookie",
"tokenType":"",
"authHeaderName":"Cookie",
"retryFailureStatusCode":[
401
],
"accessToken":"sdfghjk",
"testConnectionParams":{
"http":{
"url":xxx,
"httpHeaders":{
"Content-Type":"application/json"
},
"properties":{
"userName":"xxx",
"password":"xxxx"
},
"httpContentType":"application/json",
"httpMethod":"POST"
},
"successResponse":[
],
"successResponsePath":"responseText",
"errorPath":"responseText",
"retryFailureStatusCode":[
401
]
}
}
}
}
Logs in Saviynt :
2024-04-25T18:26:50+05:30-ecm-rest.RestProvisioningService-http-nio-8080-exec-68-gj8fs-DEBUG-Got Webservice API Response: [headers:[Cache-Control: no-cache, no-store, must-revalidate, Pragma: no-cache, Content-Type: application/json, Expires: -1, Server: , Strict-Transport-Security: max-age=31536000; includeSubDomains; preload, X-ASPNET-VERSION: , X-POWERED-BY: , Date: Thu, 25 Apr 2024 12:56:50 GMT, Content-Length: 100, Set-Cookie=******/; Httponly; Secure], responseText:{"Message":"Failed to deserialize JSON, please ensure it is formatted correctly.","StackTrace":null}, cookies:[NGSecure=rd3o00000000000000000000ffff0a62c81fo4443; path=/; Httponly; Secure], statusCode:400]
[This message has been edited by moderator to disable url hyperlink]
04/30/2024 08:44 PM
"access_token": "NGSecure abc"
05/01/2024 10:27 PM
Already we have tried , still shows same error.
"access_token": "NGSecure abc"
05/02/2024 11:39 AM
The issue has been fixed after making below changes to Connection JSON.
1. "userName", attribute is case sensitive and was updated to "username".
2. "username":"xx", "password":"xxx" are to be defined under httpParams
05/02/2024 11:50 AM
For reference please share the working JSON because multiple suggestions are provided so trying to see how the final one looks like.
05/02/2024 12:28 PM
@kmashwini can you please share the final JSON we used.
05/02/2024 08:19 PM - edited 05/02/2024 08:19 PM
{
"authentications": {
"acctAuth": {
"authType": "oauth2",
"url": "",
"httpMethod": "POST",
"httpParams": {},
"properties": {
"username": "xxx",
"password": "xxxx"
},
"httpHeaders": {
"Content-Type": "application/json"
},
"httpContentType": "application/json",
"expiryError": "ExpiredAuthenticationToken",
"authError": [
"USER_AUTHENTICATION_FAILED",
"false"
],
"timeOutError": "error",
"errorPath": "error",
"maxRefreshTryCount": 3,
"tokenResponsePath": "#HEADERS#Set-Cookie",
"tokenType": "",
"authHeaderName": "Cookie",
"retryFailureStatusCode": [
401
],
"accessToken": "sdfghjk",
"testConnectionParams": {
"http": {
"url": "xxx",
"httpHeaders": {
"Content-Type": "application/json"
},
"properties": {
"userName": "xxx",
"password": "xxxx"
},
"httpContentType": "application/json",
"httpMethod": "POST"
},
"successResponse": [],
"successResponsePath": "responseText",
"errorPath": "responseText",
"retryFailureStatusCode": [
401
]
}
}
}
}
06/29/2024 10:14 PM
If the auth type is oauth2, then what we need to enter in username and password section, is it the client id, and secret?
06/30/2024 09:28 PM
Its based on application what parameters are required for API
@Saviynt_learner Raise new post for new issue.
07/03/2024 10:41 PM
Also While using basic auth whats the need of using below attributes:
Here what token are we getting exactly. I'm unable to understad the logic exactly.
07/03/2024 10:59 PM
It will be base64 encoded username:password please create new thread for your concern
05/03/2024 02:59 AM
The below JSON is working JSON.
{
"authentications": {
"acctAuth": {
"authType": "oauth2",
"httpHeaders": {
"Content-Type": "application/json"
},
"authError": [
"Unauthorized",
"Invalid session",
"A valid session is required for API access."
],
"url": xxx,
"httpMethod": "POST",
"httpContentType": "application/json",
"errorPath": "Message",
"maxRefreshTryCount": 5,
"tokenResponsePath": "#HEADERS#Set-Cookie",
"tokenType": "",
"authHeaderName": "Cookie",
"accessToken": "abc",
"httpParams": {
"username": "xxx",
"password": "xxx"
},
"retryFailureStatusCode": [
401,
400
]
}
}
}