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

Issue with custom REST API

aundreb
Regular Contributor II
Regular Contributor II

Hello,

 

I have an issue with my custom REST API which will be used to import users.

The connection json works but doesn't seem to be passing the access_token from the response to the saviynt ${access_token} token variable to be used in the importjson. JSON files below.

 

ConnectionJSON(Client specific data scrubbed):

{
"authentications": {
"userAuth": {
"authType": "oauth2",
"url":"",
"httpMethod": "POST",
"httpParams": {
"client_id": "",
"client_secret": "",
"username": "",
"company": "",
"password": "",
"grant_type": "password"
},
"httpHeaders": {
"Content-Type": "application/x-www-form-urlencoded"
},
"httpContentType": "application/x-www-form-urlencoded",
"expiryError": "ExpiredAuthenticationToken",
"authError": [
"USER_AUTHENTICATION_FAILED",
"PARTNER_AUTHENTICATION_FAILED",
"AuthenticationFailed"
],
"errorPath": "errorCode",
"maxRefreshTryCount": 5,
"tokenResponsePath": "AuthenticationResult.AccessToken",
"retryFailureStatusCode": [
401
]
}
}
}

UserimportJSON:

{
"connection": "userAuth",
"url": "<API URL>",
"httpMethod": "GET",
"httpHeaders": {
"contentType": "application/x-www-form-urlencoded",
"Authorization": "${access_token}"},
"colsToPropsMap": {
"username": "<>~#~char",
"statuskey": "statuskey~#~char",
"preferedfirstname": "PreferredName~#~char",
"employeeid": "Empno~#~char",
"employeetype": "JobStatus~#~char",
"departmentname": "LocationName~#~char",
"displayname": "displayname~#~char",
"customproperty2": "FirstLanguage~#~char",
"leavestatus": "leavestatus~#~char",
"middlename": "Initial~#~char",
"location": "HomeOffice~#~char",
"firstname": "GivenName~#~char",
"lastname": "Surname~#~char",
"customproperty4": "PreviousSurname~#~char",
"title": "PositionName~#~char",
"customproperty15": "customtitle~#~char",
"startdate": "LastHireDate~#~char",
"customproperty5": "InitialHireDate~#~char",
"termDate": "TerminationDate~#~char",
"customproperty56": "Supervisorempno~#~char"},
"errorCode":"400",
"errorCodePath":"errorCode",
"userResponsePath": "results",
"userResponsePath": "value",
"pagination": {
"offset": {
"offsetParam": "Offset",
"batchParam": "Max",
"batchSize": 1000,
"totalCountPath": "total_count"
},
"nextUrl": { "nextUrlPath": "object.userProfile.Link"}
}

 

5 REPLIES 5

rushikeshvartak
All-Star
All-Star

Can you share screenshot of  working connection post from postman


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

aundreb
Regular Contributor II
Regular Contributor II

Here is the connection post from postman

Here’s the token:

aundreb_0-1660585893506.png

and here is the Get that would be used in the importuserjson

aundreb_1-1660585938864.pngaundreb_2-1660585947180.png

 

 

 

{
  "authentications": {
    "userAuth": {
      "authType": "oauth2",
      "url": "",
      "httpMethod": "POST",
      "httpParams": {
        "client_id": "",
        "client_secret": "",
        "username": "",
        "company": "",
        "password": "",
        "grant_type": "password"
      },
      "httpHeaders": {
        "Content-Type": "application/x-www-form-urlencoded"
      },
      "httpContentType": "application/x-www-form-urlencoded",
      "expiryError": "ExpiredAuthenticationToken",
      "authError": [
        "USER_AUTHENTICATION_FAILED",
        "PARTNER_AUTHENTICATION_FAILED",
        "AuthenticationFailed"
      ],
      "errorPath": "errorCode",
      "maxRefreshTryCount": 5,
      "tokenResponsePath": "access_token",
      "tokenType": "Bearer",
      "accessToken": "Bearer idk",
      "retryFailureStatusCode": [
        401
      ]
    }
  }
}

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

aundreb
Regular Contributor II
Regular Contributor II

Thanks Rushikesh. How does Saviynt handle the access token not being known? As I see that you've put accessToken: "Bearer idk" . Basically looking for saviynt to input the access token from the tokenresponsepath every time to the accessToken variable.

 

Thanks,

Aundre

Specify the access token if its already available, else specify a dummy value or leave it blank. This value may change after the token refresh.

https://saviynt.freshdesk.com/support/solutions/articles/43000521736-rest-connector-guide#RESTConnec... 

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