and more in a single search tool across platforms. Read the announcement here. |
02/13/2023 07:20 AM
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"
}
}
}
Solved! Go to Solution.
02/13/2023 08:22 AM
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
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"
}
}
}
02/13/2023 08:44 AM
If you find the provided solution useful, please give us a kudos in the forum.
02/13/2023 09:46 AM
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.
02/13/2023 10:31 AM
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.
02/13/2023 01:17 PM
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?
02/13/2023 03:19 PM
Share postman screenshot
02/13/2023 09:34 PM
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.
02/13/2023 11:55 PM
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
02/14/2023 01:59 AM
I found the problem. I run it through whitespace removal tool (Remove Extra Spaces Online: Whitespace and Tab (codebeautify.org)), now it is working.