combination of basic auth and access token for user import api call

Abdul_Gaffar
New Contributor II
New Contributor II

Hi ,

In our API call for users list we have a combination of basic auth credentials and access token to retrieve users.

The following is the connection json for the same , please suggest what shall be the way to inculcate the both authorizations in the user import api call

error we get while doing  a save&test connection is 401 unauthrorized

{
"authentications": {
"acctAuth": {
"authType": "oauth2",
"url": "https://<URL>",
"httpMethod": "POST",
"httpParams": {"client_id": "<clientid>",
"client_secret": "<clientsecret>",
"grant_type": "client_credentials"},
"httpHeaders": {
"contentType": "application/x-www-form-urlencoded"
},
"httpContentType": "application/x-www-form-urlencoded",
"expiryError": "Couldn't authenticate you",
"authError": [
"Couldn't authenticate you"
],
"timeOutError": "Read timed out",
"errorPath": "error",
"maxRefreshTryCount": 5,
"tokenResponsePath": "access_token",
"tokenType": "Bearer",
"accessToken": "Beare 5RQX5CgeakC",
"testConnectionParams": {
"http": {
"url": "https://<URL>",
"httpHeaders": {
"Authorization": "${access_token}",
"APIKey": "<APIKEY>",
"Content-Type": "application/json",
"Accept": "application/json",
"USERNAME": "<username>",
"PASSWORD": "<password>"
},
"httpContentType": "application/json",
"httpMethod": "GET"
},
"successResponse": [
200
],
"successResponsePath": "",
"errors": [
"Couldn't authenticate you"
],
"errorPath": "error"
}
}
}
}

1 REPLY 1

naveenss
All-Star
All-Star

Hi @Abdul_Gaffar  can you please try with the below JSON? I have added the retryFailureStatusCode

 

{
    "authentications": {
        "acctAuth": {
            "authType": "oauth2",
            "url": "https://<URL>",
            "httpMethod": "POST",
            "httpParams": {
                "client_id": "<clientid>",
                "client_secret": "<clientsecret>",
                "grant_type": "client_credentials"
            },
            "httpHeaders": {
                "contentType": "application/x-www-form-urlencoded"
            },
            "httpContentType": "application/x-www-form-urlencoded",
            "expiryError": "Couldn't authenticate you",
            "authError": [
                "Couldn't authenticate you"
            ],
            "timeOutError": "Read timed out",
            "errorPath": "error",
            "maxRefreshTryCount": 5,
            "tokenResponsePath": "access_token",
            "tokenType": "Bearer",
            "accessToken": "Bearer abcd",
			"retryFailureStatusCode": [
                401
            ],
            "testConnectionParams": {
                "http": {
                    "url": "https://<URL>",
                    "httpHeaders": {
                        "Authorization": "${access_token}",
                        "APIKey": "<APIKEY>",
                        "Content-Type": "application/json",
                        "Accept": "application/json",
                        "USERNAME": "<username>",
                        "PASSWORD": "<password>"
                    },
                    "httpContentType": "application/json",
                    "httpMethod": "GET"
                },
                "successResponse": [
                    200
                ],
                "successResponsePath": "",
                "errors": [
                    "Couldn't authenticate you"
                ],
                "errorPath": "error"
            }
        }
    }
}

 

Regards,
Naveen Sakleshpur
If this reply answered your question, please click the Accept As Solution button to help future users who may have a similar problem.