Saviynt unveils its cutting-edge Intelligence Suite products to revolutionize Identity Security!
Click HERE to see how Saviynt Intelligence is transforming the industry.
Saviynt Copilot Icon

REST Connection: Pass APIKey in Basic Auth

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on October 13 2020 at 12:56 UTC

Hi,


I have a REST API that uses Basic authentication(username and password) along with an APIKey which is to be passed in the http header of my connection JSON as:


{

"authentications": {

"acctAuth": {

"authType": "Basic",

"url": "https://##########/NetForms/restapi/component/user",

"httpMethod": "POST",

"httpParams": {

},

"httpHeaders": {

"APIKey": "###########################"

},

"httpContentType": "text/html",

"properties": {

"userName": "############",

"password": "##########"

},

"expiryError": "Couldn't authenticate you",

"authError": [

"Couldn't authenticate you"

],

"timeOutError": "Read timed out",

"errorPath": "error",

"maxRefreshTryCount": 5,

"tokenResponsePath": "access_token",

"tokenType": "Basic",

"accessToken": "Basic abcdef",

"testConnectionParams": {

"http": {

"url": "https://#########/NetForms/restapi/component/user",

"httpHeaders": {

"Authorization": "${access_token}"

},

"httpContentType": "application/json",

"httpMethod": "GET"

},

"successReponse": [

200,

204

],

"successResponsePath": "",

"errors": [

"Couldn't authenticate you"

],

"errorPath": "error"

}

}

}

}


However, my connection JSON does not recognize the API key and I get a 401 unauthorized error.

The same call is working in Postman by passing the API key in the headers:

image



Is there any way I can pass this APIKey in Saviynt Connection JSON to be able to connect successfully?

Any help would be greatly appreciated.

This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.
2 REPLIES 2

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on October 15 2020 at 11:15 UTC

Hi Arushi,


Is there a separate API to get the access token? if yes, then it won't be a basic connection type

if no, then the x API key need not be specified in the connection JSON.It can be specified under http Headers as shown below in the import and provisioning JSONS

sample:

"httpHeaders": {

"Authorization": "${access_token}",

"x-apikey": "**********"

}

Can you please share more details and screenshots from the postman if possible?

Thank you

Vedanth B.K


This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on October 15 2020 at 16:05 UTC

Hi Vedant,


Thanks for the information. I was able to fetch data by passing the API Key in the import and provisioning JSON.

This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.