Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

REST API - JSON syntax exception found in the following connection parameters - ConnectionJSON

luka_harabajsa
New Contributor III
New Contributor III

Hello, i am working on REST API Connection, i am getting described error during Save&test (JSON syntax exception found in the following connection parameters)

This is ConnectionJSON:

 

{
  "authentications": {
    "userAuth": {
      "authType": "oauth2",
      "url": "https://login.microsoftonline.com/TenantID/oauth2/v2.0/token",
      "httpMethod": "POST",
      "httpParams": {
        "grant_type": "client_credentials",
        "client_secret": "client_secret",
        "client_id": "client_id",
        "scope": "https://xyz.crm4.dynamics.com/.default"
      },
      "httpHeaders": {
        "contentType": "application/x-www-form-urlencoded"
      },
      "httpContentType": "application/x-www-form-urlencoded",
      "expiryError": "ExpiredAuthenticationToken",
      "authError": [
"InvalidAuthenticationToken",
"AuthenticationFailed",
"FAILURE",
"INVALID_SESSION_ID"
      ],
      "retryFailureStatusCode": [
        401
      ],
      "timeOutError": "Read timed out",
      "errorPath": "errors.type",
      "maxRefreshTryCount": 5,
      "tokenResponsePath": "access_token",
      "tokenType": "Bearer",
      "accessToken": "Bearer abcd"
    },
    "entAuth": {
      "authType": "oauth2",
      "url": "https://login.microsoftonline.com/TenantID/oauth2/v2.0/token",
      "httpMethod": "POST",
      "httpParams": {
        "grant_type": "client_credentials",
        "client_secret": "client_secret",
        "client_id": "client_secret",
        "scope": "https://xyz.crm4.dynamics.com/.default"
      },
      "httpHeaders": {
        "contentType": "application/x-www-form-urlencoded"
      },
      "httpContentType": "application/x-www-form-urlencoded",
      "expiryError": "ExpiredAuthenticationToken",
      "authError": [
"InvalidAuthenticationToken",
"AuthenticationFailed",
"FAILURE",
"INVALID_SESSION_ID"
      ],
      "retryFailureStatusCode": [
        401
      ],
      "timeOutError": "Read timed out",
      "errorPath": "errors.type",
      "maxRefreshTryCount": 5,
      "tokenResponsePath": "access_token",
      "tokenType": "Bearer",
      "accessToken": "Bearer abcd"
    }
  }
}

9 REPLIES 9

DixshantValecha
Saviynt Employee
Saviynt Employee

I appreciate you reaching out to the Saviynt forums.

Based on our validation of the ConnectionJSON, I discovered the following error.
In Java, strings are enclosed in double quotes ("). In the old code, the string "client_id" had a value of "client_secret" which is an invalid value. In the new code, the string "client_id" has a value of "client_id" which is correct. The change was necessary as the old code would have resulted in an error.

This was a change on codeline 41.attaching a snapshot for your reference 

DixshantValecha_0-1676305041082.png

Please find attached the new code for your reference.

{
"authentications": {
"userAuth": {
"authType": "oauth2",
"url": "https://login.microsoftonline.com/TenantID/oauth2/v2.0/token",
"httpMethod": "POST",
"httpParams": {
"grant_type": "client_credentials",
"client_secret": "client_secret",
"client_id": "client_id",
"scope": "https://xyz.crm4.dynamics.com/.default"
},
"httpHeaders": {
"contentType": "application/x-www-form-urlencoded"
},
"httpContentType": "application/x-www-form-urlencoded",
"expiryError": "ExpiredAuthenticationToken",
"authError": [
"InvalidAuthenticationToken",
"AuthenticationFailed",
"FAILURE",
"INVALID_SESSION_ID"
],
"retryFailureStatusCode": [
401
],
"timeOutError": "Read timed out",
"errorPath": "errors.type",
"maxRefreshTryCount": 5,
"tokenResponsePath": "access_token",
"tokenType": "Bearer",
"accessToken": "Bearer abcd"
},
"entAuth": {
"authType": "oauth2",
"url": "https://login.microsoftonline.com/TenantID/oauth2/v2.0/token",
"httpMethod": "POST",
"httpParams": {
"grant_type": "client_credentials",
"client_secret": "client_secret",
"client_id": "client_id",
"scope": "https://xyz.crm4.dynamics.com/.default"
},
"httpHeaders": {
"contentType": "application/x-www-form-urlencoded"
},
"httpContentType": "application/x-www-form-urlencoded",
"expiryError": "ExpiredAuthenticationToken",
"authError": [
"InvalidAuthenticationToken",
"AuthenticationFailed",
"FAILURE",
"INVALID_SESSION_ID"
],
"retryFailureStatusCode": [
401
],
"timeOutError": "Read timed out",
"errorPath": "errors.type",
"maxRefreshTryCount": 5,
"tokenResponsePath": "access_token",
"tokenType": "Bearer",
"accessToken": "Bearer abcd"
}
}
}

 

 

 

 

 

 

 

DixshantValecha
Saviynt Employee
Saviynt Employee

If you find the provided solution useful, please give us a kudos in the forum.

luka_harabajsa
New Contributor III
New Contributor III

Sorry that was my mistake during c/p. Of course, I didn't put real values on forum, but in Saviynt EIC configuration, that is populated with correct data. 

I tested through Postman, and i get token, but on Saviynt i get an error as I described.

Did you try to validate you JSON? You can use: https://jsonlint.com/ to validate you JSON.

I know you didn't copy paste exact json(to remove sensitive data) so not sure if exact same format is used in connection or not. But I can see format shared here is looks good I don't see any format issue.

I would suggest use above site to validate your connection JSON to see if there is any format issue.


Regards,
Saathvik
If this reply answered your question, please Accept As Solution and give Kudos to help others facing similar issue.

luka_harabajsa
New Contributor III
New Contributor III

Hey, yeah i tried to validate my JSON, and it looks fine. I also tried to c/p exact example from documentation and it still fails with the same error.

Could some other JSON from config cause problems during save and test? I have also JSON's for ImportAccount and CreateAccount?

 

Share postman screenshot


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

The other JSON's defined can also cause the error. The best way to find out would be to remove all your json's and then add them 1 by 1 using Save & Test option.

 


Regards,
Sahil

luka_harabajsa
New Contributor III
New Contributor III

Sorry, I accidentally press "Accept as solution".

 

I tried to delete all other JSON in Connection, but still no luck. Error is the same.

 

Here is a screenshot from Postman

luka_harabajsa_1-1676361339358.png

 

 

I found the problem. I run it through whitespace removal tool (Remove Extra Spaces Online: Whitespace and Tab (codebeautify.org)), now it is working.