API Connector: Access Body data using Basic Auth

Hello,

I have a Basic Auth token request to a Wild Apricot site. I have been able to make it work in Postman but i cannot find in the API connector under Basic Auth a way to add the following to the Body of the POST. Postman has an explicit Body tab but there is no equivalent field in the API Connector. Here is the body data that I am trying to enter:

grant_type=client_credentials&scope=contacts

grant type and scope don’t seem to work as either parameters or header keys; i have tried both. The Postman call works: note the grant_type…line.

POST /auth/token HTTP/1.1
Host: oauth.wildapricot.org
Content-Type: application/x-www-form-urlencoded
cache-control: no-cache
Postman-Token: 03b1c95c-bc7c-4a50-bc4b-f5e6ffa65e33
grant_type=client_credentials&scope=contacts_view------WebKitFormBoundary7MA4YWxkTrZu0gW–

Here is a link to the documentation for the API that I am trying to link to:

Wild Apricot API access options

Thank you in advance for any suggestions.

Could you post a screenshot of what you have in bubble and what the error message is please ?

Although I think what you probably need to do as set the Body Type to JSON, which will expose the body input, then type in the formdata like this …

&grant_type=client_credentials&scope=contacts_view

Make sure you have the content-type header param set to application/x-www-form-urlencoded

And make sure you have urlencoded the parameters if need (so spaces in your scopes etc).

You may have got this far already, but for Basic auth you may need to encode "user : password " in base64 and pass it in a header parameter Authorization following Basic.

So Basic 7d8sahdisoads9ad7sadhjashdjsah or whatever your encoded value is.

Thank you for responding.

I figured out why there was no option to put data into the Body of the call: what Postman calls Basic Auth is not the same as the API Connector’s HTTP Basic Auth. The former allows a Body but the latter has no option for a Body; I should have realized this when there was no field for a separate token request endpoint in the API Connector. I probably did not because I was too focused on looking for a way to encode the username:password and first found it using Basic Auth on Postman. So, I conflated Postman’s Basic Auth with the API Connector’s HTTP Basic Auth.

The proper approach on the API Connector was to use Oauth2 Custom Token, which does have a Body. I had failed to get that to work at the start, went to Postman, realized that I had to encode the password, and then went back to API Connector HTTP Basic Auth believing incorrectly that it was the analog of my success on Postman. On my second effort with API Connector Oauth2 Custom Token, you provided me a critical piece of information: in addition to the API being encrypted the username is also encrypted. I took the encrypted version of username:password from the Postman success and dumped it into the the Authorization header of the API Connector using Oauth2 Custom Token, and that established the connection.

So, I got it to work. However there must be a better way, hopefully within Bubble, to encrypt the username:password.

Thank you for your attention and assistance.

1 Like