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

Getting 401 unauthorized error in coupa connection Json

Shwet01
Regular Contributor
Regular Contributor

Hi Folks,

We are integrating coupa and saviynt application. Our connection Json was working as expected, but now we have started getting an 401 unauthorized error in logs. Tasks are failing. We have not made any changes to connection json, the only issue we had earlier with connection json was that token was getting refreshed in 24hrs automatically. We are not able to understand that why we are suddenly getting this 401 error, if anyone has similar issue and has idea why it happened.

 

Connection json-

{
"authentications": {
"acctAuth": {
"authType": "oauth2",
"url": "https:/xxxxxxxxxxx/oauth2/token",
"httpMethod": "POST",
"httpParams": {
"client_secret": "f23ba40c2c722cb0b1afdb1325xxxxxxxxxx",
"client_id": "1023fda811c77xxxxxxxxxxxxxxx",
"scope": "core.user_group.read core.user_group.write core.user.read core.user.write email login profile"
},
"httpHeaders": {
"contentType": "application/x-www-form-urlencoded"
},
"httpContentType": "application/x-www-form-urlencoded",
"expiryError": "ExpiredAuthenticationToken",
"authError": [
"InvalidAuthenticationToken",
"AuthenticationFailed"
],
"timeOutError": "Read timed out",
"errorPath": "error.code",
"maxRefreshTryCount": 5,
"tokenType": "bearer",
"tokenResponsePath": "access_token",
"authHeaderName": "Authorization",
"accessToken": "Bearer eyJ0eXAiOiJhdCtKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IjRmOjMzOmI3OmY3OjVmOjg4OjQ3OmRhOjAzOmVmOjkzOjQ1OmU5OmNjOmZiOjg3In0.eyJpc3MiOiJodHRwczovL2FiLWluYmV2LXRlc3QuY291cGFob3N0LmNvbSIsImlhdCI6MTY5MTA0NzQzNCwiZXhwIjoxNjkxMTMzODM0LCJzdWIiOiIxMDIzZmRhODExYzc3OTRlNGNkOWQ0MTk5YWM5ZGJjYiIsImp0aSI6ImMxMTJhNWVkLWEwZTMtNGU2Zi05YTYzLTVkNTNiYmM1NTFkZiIsImNsaWVudF9pZCI6IjEwMjNmZGE4MTFjNzc5NGU0Y2Q5ZDQxOTlhYzlkYmNiIiwic2NvcGUiOiJjb3JlLnVzZXJfZ3JvdXAucmVhZCBjb3JlLnVzZXJfZ3JvdXAud3JpdGUgY29yZS51c2VyLnJlYWQgY29yZS51c2VyLndyaXRlIGVtYWlsIGxvZ2luIHByb2ZpbGUiLCJhdWQiOlsiY29yZSJdfQ.LEd_olxMBgv1ifdxHCXiQGj1-sl9tMsR4mqRqN-pLyR6cbhg8Vz_vJ0weUtPOpENIduvk4O82ggG66Fw8QUMcopakNAM7wu0jUZJp6N3u8KCI8DKNNIjfIUiLhx0aLYdZOpejt3Yk-0xUrX_YqTcdAuvTBsfCGqYzkepEg6jcViCt56mTwYUEWvRsQRqvLemBc6SMguVHcthQQ5QZ5YMrLvM2jEi7gZH2wyD4v-B5L8_LonaEelvzDHPaatK8VREAcsSwgLtF4u6cU5RQGxE6jCHCNGOxnRFxkyhNiTYV9_xY0-xmu50yBnXj89DyODkc9ixZrW3bZdRro3XlX_ohg",
"retryFailureStatusCode": [
401,
400
]
}
}
}

 

Shwet01_1-1691048944619.png

 

 

 

Thanks

shwet

5 REPLIES 5

pmahalle
All-Star
All-Star

@Shwet01 ,

Can you try by passing credentials in url as query parameters instead of http params like below:


"authentications": {
"acctAuth": {
"authType": "oauth2",
"url": "https:/xxxxxxxxxxx/oauth2/token?client_secret=f23ba40c2c722cb0b1afdb1325xxxxxxxxxx&client_id=1023fda811c77xxxxxxxxxxxxxxx&scope=core.user_group.read core.user_group.write core.user.read core.user.write email login profile",
"httpMethod": "POST",
"httpParams": {
},
"httpHeaders": {
"contentType": "application/x-www-form-urlencoded"
},


Pandharinath Mahalle(Paddy)
If this reply helps your question, please consider selecting Accept As Solution and hit Kudos 🙂

Shwet01
Regular Contributor
Regular Contributor

Hi @pmahalle ,

I have tried the same json but still not working.

Shwet01_0-1691053266726.png

 

{
"authentications": {
"acctAuth": {
"authType": "oauth2",
"url": "https://xxxxxxxxxxxxxxx/oauth2/token?client_secret=f23ba40c2c722cb0b1afdb1325e1c7e64e756a499360d23d8... core.user_group.write core.user.read core.user.write email login profile",
"httpMethod": "POST",
"httpParams": {},
"httpHeaders": {
"contentType": "application/x-www-form-urlencoded"
},
"httpContentType": "application/x-www-form-urlencoded",
"expiryError": "ExpiredAuthenticationToken",
"authError": [
"InvalidAuthenticationToken",
"AuthenticationFailed"
],
"timeOutError": "Read timed out",
"errorPath": "error.code",
"maxRefreshTryCount": 5,
"tokenType": "bearer",
"tokenResponsePath": "access_token",
"authHeaderName": "Authorization",
"accessToken": "Bearer eyJ0eXAiOiJhdCtKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IjRmOjMzOmI3OmY3OjVmOjg4OjQ3OmRhOjAzOmVmOjkzOjQ1OmU5OmNjOmZiOjg3In0.eyJpc3MiOiJodHRwczovL2FiLWluYmV2LXRlc3QuY291cGFob3N0LmNvbSIsImlhdCI6MTY5MTA0NzQzNCwiZXhwIjoxNjkxMTMzODM0LCJzdWIiOiIxMDIzZmRhODExYzc3OTRlNGNkOWQ0MTk5YWM5ZGJjYiIsImp0aSI6ImMxMTJhNWVkLWEwZTMtNGU2Zi05YTYzLTVkNTNiYmM1NTFkZiIsImNsaWVudF9pZCI6IjEwMjNmZGE4MTFjNzc5NGU0Y2Q5ZDQxOTlhYzlkYmNiIiwic2NvcGUiOiJjb3JlLnVzZXJfZ3JvdXAucmVhZCBjb3JlLnVzZXJfZ3JvdXAud3JpdGUgY29yZS51c2VyLnJlYWQgY29yZS51c2VyLndyaXRlIGVtYWlsIGxvZ2luIHByb2ZpbGUiLCJhdWQiOlsiY29yZSJdfQ.LEd_olxMBgv1ifdxHCXiQGj1-sl9tMsR4mqRqN-pLyR6cbhg8Vz_vJ0weUtPOpENIduvk4O82ggG66Fw8QUMcopakNAM7wu0jUZJp6N3u8KCI8DKNNIjfIUiLhx0aLYdZOpejt3Yk-0xUrX_YqTcdAuvTBsfCGqYzkepEg6jcViCt56mTwYUEWvRsQRqvLemBc6SMguVHcthQQ5QZ5YMrLvM2jEi7gZH2wyD4v-B5L8_LonaEelvzDHPaatK8VREAcsSwgLtF4u6cU5RQGxE6jCHCNGOxnRFxkyhNiTYV9_xY0-xmu50yBnXj89DyODkc9ixZrW3bZdRro3XlX_ohg",
"retryFailureStatusCode": [
401,
400
]
}
}
}

 

Thanks

shweta

Hi @Shwet01 ,

Are you able to generate token in postman? What's the content type you are using in Postman?

Can you try with below in your connection json and check:

"httpContentType": "application/json"


Pandharinath Mahalle(Paddy)
If this reply helps your question, please consider selecting Accept As Solution and hit Kudos 🙂

Shwet01
Regular Contributor
Regular Contributor

Hi @pmahalle ,

Yes i am able to generate the token in postman. Content type we used in postman is below -

Shwet01_0-1691059131279.png

 

Thanks

shweta

Shwet01
Regular Contributor
Regular Contributor

Hi @shilpa_,

Can you share your connection json for coupa by  removing all your client details. We are getting this 401 error.

Thanks

shweta