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 Account Import Error - "The token was expected to have 3 parts, but got 1"

IGAQ
New Contributor III
New Contributor III

Hello All,

We have REST application configured , while running account import  job - getting below error in the logs

{"error":"internal_server_error","error_description":"The token was expected to have 3 parts, but got 1."}statusCode:500]"

Here is the ImportAccEntJSON:

{
"accountParams": {
"connection": "acctAuth",
"processingType": "SequentialAndIterative",
"call": {
"call1": {
"callOrder": 0,
"stageNumber": 0,
"http": {
"url": "https://xxxxxxxxxxx:8442/security/v2.1/domains/Main/applications/tm/users",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"httpMethod": "GET"
},
"statusConfig": {
"active": "A",
"inactive": "T"
},
"listField": "users",
"keyField": "accountID",
"colsToPropsMap": {
"name": "username~#~char",
"status": "active~#~char",
"accountID": "username~#~char",
"customproperty1": "uid~#~char",
"CUSTOMPROPERTY2": "idp~#~char",
"customproperty3": "ad_domain~#~char",
"CUSTOMPROPERTY4": "nick_name~#~char",
"CUSTOMPROPERTY5": "user_type~#~char"
}
}
}
},
"entitlementParams": {
"entTypes": {
"Roles": {
"entTypeOrder": 1,
"entTypeLabels": {},
"call": {
"call1": {
"connection": "acctAuth",
"callOrder": 0,
"stageNumber": 0,
"http": {
"httpHeaders": {
"Authorization": "${access_token}"
},
"url": "https://xxxxxxxxxxx:8443/v2.1/roles?domainName=Main&applicationName=TM",
"httpContentType": "application/json",
"httpMethod": "GET"
},
"listField": "result",
"keyField": "entitlementID",
"colsToPropsMap": {
"description": "description~#~char",
"customproperty3": "elevated_privilege~#~char",
"entitlementID": "id~#~char",
"entitlement_Value": "name~#~char",
"displayname": "name~#~char"
}
}
}
}
}
},
"acctEntParams": {
"entTypes": {
"Roles": {
"call": {
"call1": {
"connection": "acctAuth",
"processingType": "http",
"http": {
"url": "https://xxxxxxxxxxx:8443/v2.1/Users/209",
"httpContentType": "application/json",
"httpMethod": "GET",
"httpHeaders": {
"Authorization": "${access_token}"
}
},
"listField": "",
"acctKeyField": "accountID",
"entKeyField": "entitlementID",
"acctIdPath": "",
"entIdPath": ""
}
}
}
}
}
}

Note: All  access token generation & get users api calls works fine in POSTMAN

 

Best Regards,sb

 

 

18 REPLIES 18

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 you find this response useful, kindly consider selecting 'Accept As Solution' and clicking on the 'Kudos' button.

IGAQ
New Contributor III
New Contributor III

Please find below

IGAQ_0-1718643115674.png

 

curl --location 'https://xxxxxxxxx/security/v2.1/user/token' --header 'Content-Type: application/json' --data '{"idp": "xxxx","username":"xxxx","password": "xxxxxxxxx"}'

 

ConnectionJSON:

{
"authentications": {
"acctAuth": {
"authType": "oauth2",
"url": "https://xxxxxxx/security/v2.1/user/token",
"httpMethod": "POST",
"httpParams": "{\"idp\":\"xxxxxx\",\"username\":\"xxxxxx\",\"password\":\"xxxxxxxx\"}",
"httpHeaders": {
"Accept": "application/json"
},
"httpContentType": "application/json",
"authError": [
"InvalidAuthenticationToken"
],
"errorPath": "error.code",
"maxRefreshTryCount": 2,
"tokenResponsePath": "accessToken",
"tokenType": "Bearer",
"accessToken": "Bearer abc",
"retryFailureStatusCode": [
401
]
}
}
}

 

Thanks,

 

Does application needs access token or refresh token ?


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

IGAQ
New Contributor III
New Contributor III

access token

Please share logs in text file. once you run import job


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

IGAQ
New Contributor III
New Contributor III

Please find attached logs.

NM
Valued Contributor II
Valued Contributor II

Hi @IGAQ , try this once

{

"authentications": {

"acctAuth": {

"authType": "oauth2",

"url": "https://xxxxxxx/security/v2.1/user/token",

"httpMethod": "POST",

"httpParams": "{\"idp\":\"xxxxxx\",\"username\":\"xxxxxx\",\"password\":\"xxxxxxxx\"}",

"httpHeaders": {

"Accept": "application/json"

},

"httpContentType": "application/json",

"authError": [

"InvalidAuthenticationToken"

],

"errorPath": "error.code",

"maxRefreshTryCount": 2,

"tokenResponsePath": "access_token",

"tokenType": "Bearer",

"accessToken": "Bearer abc",

"retryFailureStatusCode": [

401

]

}

}

}

IGAQ
New Contributor III
New Contributor III

Hello @NM  i have tried above it did not work, getting same exception.

NM
Valued Contributor II
Valued Contributor II

@IGAQ , can you check token call and see what all things are you passing in Body if it is working from postman?

IGAQ
New Contributor III
New Contributor III

Hi @NM   we are passing 3 params like below in the body

{ "idp": "xxxxx",
"username": "xxxxxx",
"password": "xxxxx" }

 

Thanks,

Did you tried with hardcoded token ?


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

IGAQ
New Contributor III
New Contributor III

Yes It works and pulls accounts into Saviynt, with hardcoded access token.

{
  "authentications": {
    "acctAuth": {
      "authType": "oauth2",
      "url": "https://xxxxxxx/security/v2.1/user/token",
      "httpMethod": "POST",
    "httpParams": "{\"idp\":\"xxxxxx\",\"username\":\"xxxxxx\",\"password\":\"xxxxxxxx\"}",

      "httpHeaders": {
        "contentType": "application/json"
      },
      "httpContentType": "application/json",
      "expiryError": "ExpiredAuthenticationToken",
      "authError": [
        "InvalidAuthenticationToken"
      ],
      "timeOutError": "Read timed out",
      "errorPath": "error.code",
      "maxRefreshTryCount": 5,
      "tokenResponsePath": "access_token",
      "tokenType": "Bearer",
      "accessToken": "Bearer abc"
    }
  }
}

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

IGAQ
New Contributor III
New Contributor III

Hi @rushikeshvartak  tried above getting same exception.

The token was expected to have 3 parts, but got 1

Response coming in access_token ?


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

IGAQ
New Contributor III
New Contributor III

withthe above ConnectionJSON (with out testconnection block)Its not printing any thing on save/test connection, please find logs attached.                                                                                                                          when we add testConnection block on in the ConnectionJson we are getting this error -The token was expected to have 3 parts, but got 1 

IGAQ
New Contributor III
New Contributor III

It worked by adding below in the ConnectionJSON:

"retryFailureStatusCode": [
400,401,403,500
],

You need to add all 4xx and 5xx series to get tokens regenerated in connection json


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