Pankaj Kaundal
Pankaj Kaundal

Reputation: 1022

Qliksense REST Connector error: BAD_AUTH_CODE

I am trying QlikSense REST connector for connecting HubSpot's API. Following are the parameters I am using in REST connector as per HubSpot's documentation to generate access token:

method: POST
URL: https://api.hubapi.com/oauth/v1/token
authentication schema: Basic
skip server certificate validation: checked
:: query parameters ::
grant_type = authorization_code
client_id = xxxxxxxxxxxxxxxxxxxxxx
client_secret = xxxxxxxxxxxxxxxxxxxx
redirect_uri = https://www.example.com/
code = xxxxxxxxxxxxxxxxxxxxxxxx (this is the same code i got after authorizing the access to my app using this [https://app.hubspot.com/oauth/authorize?client_id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&scope=contacts%20automation&redirect_uri=https://www.example.com/] )
Content-Type = application/x-www-form-urlencoded;charset=utf-8

Now here's what the problem is : When I use a totally refreshed code = xxxxxxxxxxxxxxxxxxxxxxxx for the first time and hit Test Connection on Qliksense REST window dialogue, I get connection successful but when I try to save that connection I get the following error enter image description here

Now from this error, at first I thought maybe my auth_code has expired but when I do the same exercise again (getting a refresh AUTH_CODE), it (QlikSense) does the same thing i.e. at first tell me connection is successful and when I try to save it I again bump into the BAD_AUTH_CODE or error 400 (Bad Request).

F.Y.I. I have tested the API with the same parameters and setting in Postman, works like a charm but not here in QlikSense.

Any idea what's going on in here? I am sure it's not HubSpot it's something to do with the REST connector.

Upvotes: 1

Views: 523

Answers (2)

Hubert Dudek
Hubert Dudek

Reputation: 1730

query parameters like "Content-Type" should be headers not query

Upvotes: 1

tshimkus
tshimkus

Reputation: 1181

Once you get the Access Token it should be passed to the API as a Header, not a parameter, as 'Authorization': 'Bearer {ACCESS_TOKEN}'

Upvotes: 1

Related Questions