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

Connection JSON not working due to incorrect token

kp2345
New Contributor
New Contributor

Hi Team , 

I have a static token let's say "Bearer fkdfkdfkd"

I used the below json and it gave me 401 error . In order to see what's getting printed in the token value i have added ${access_token} in front of the URL so it will get printed in the logs .

But in the logs i am getting a random value 

kp2345_0-1690775288598.png

-->Why is it generating a random value when i am passing the static token ? Basic dXNlcm5hbWU6cGFzc3dvcmQ= with httpParams - null and not Bearer fkdfkdfkd 
-->why is it basic by default ? i need to have it as bearer ? i have tried making the tokentype as blank and bearer too but no luck 

when i hard the token "Authorization": "Bearer fkdfkdfkd"  , it works perfectly fine . What changes needs to be done here ?

"authentications": {
"acctAuth": {
"authType": "Basic",
"url": "https://<domain name>",
"httpMethod": "POST",
"httpParams": {},
"httpHeaders": {},
"httpContentType": "text/html",
"properties": {
"userName": "username",
"password": "password"
},
"expiryError": "Couldn't authenticate you",
"authError": [
"Couldn't authenticate you"
],
"timeOutError": "Read timed out",
"errorPath": "error",
"maxRefreshTryCount": 5,

"tokenType": "",
"accessToken": "Bearer fkdfkdfkd",
"testConnectionParams": {
"http": {
"url": "https://randomurl/provisioning/api/7.0/scim/v2/Users ${access_token}",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"httpMethod": "GET"
},
"successResponse": [],
"successResponsePath": "",
"errors": [
"Couldn't authenticate you"
],
"errorPath": "error"
}
}
}
}

@sahajranajee  @rushikeshvartak @Sivagami please help

[This post has been edited to merge reply comment by moderator]

1 REPLY 1

DixshantValecha
Saviynt Employee
Saviynt Employee

Hi ,

It seems like you are trying to use a static token for authentication, but you are getting an error. 

First of all, I noticed that you are using the Basic authType in your authentications object. This means that you are sending the username and password as a base64-encoded string in the Authorization header. However, you want to use a static token instead, so you should change the authType to Bearer. This will tell the server that you are sending a bearer token in the Authorization header.

Second, I think the reason why you are getting a random value in the logs is because you are using ${access_token} in the url and the header. This is a variable that will be replaced by the actual value of the access token when the request is made. However, since you are using a static token, you don’t need to use this variable. You can just use the static token directly in both places.

So, your authentications object should look something like this:

“authentications”: { “acctAuth”: { “authType”: “Bearer”, “url”: “https://<domain name>”, “httpMethod”: “POST”, “httpParams”: {}, “httpHeaders”: {}, “httpContentType”: “text/html”, “properties”: { “userName”: “username”, “password”: “password” }, “expiryError”: “Couldn’t authenticate you”, “authError”: [ “Couldn’t authenticate you” ], “timeOutError”: “Read timed out”, “errorPath”: “error”, “maxRefreshTryCount”: 5,

“tokenType”: “”, “accessToken”: “Bearer fkdfkdfkd”, “testConnectionParams”: { “http”: { “url”: “https://randomurl/provisioning/api/7.0/scim/v2/Users Bearer fkdfkdfkd”, “httpHeaders”: { “Authorization”: “Bearer fkdfkdfkd” }, “httpContentType”: “application/json”, “httpMethod”: “GET” }, “successResponse”: [], “successResponsePath”: “”, “errors”: [ “Couldn’t authenticate you” ], “errorPath”: “error” } } }

Please validate and let us know if further details are needed on this.