Unsupported media type in API connector?

Hi all,

has anyone experience the error “Unsupported Media Type” when using the API connector?
26%20am

not sure what is going on, but it is a basic general POST request. can delve further into the specifics if needed, but initially i am just wondering if anyone has seen this error and possibly why, if known?

thanks!

Can you show your setting?
The issue doesn’t seem to come from Bubble but from the API you are trying to post

Hi @Jici,
this is occurring when initiating with my own account in quickbooks, the calls are built using their API documentation…not sure why they are not working with bubbles api connector?..i would be happy to build this using bubbles oauth2 authentication methods, ie. password, user-agent, or custom token flow,
54%20am
but couldn’t find any documentation from bubble to help build it out?

here are the settings for each call in my API connector…

For oauth2, you need more to read the API doc than bubble doc.
https://developer.intuit.com/app/developer/qbo/docs/develop/authentication-and-authorization/oauth-2.0

There’s a lot of step in (create your app first in QBO dev portal).
Actually, you are not setting your call correctly.
I suggest to try the oauth process
Authorize url is: https://appcenter.intuit.com/connect/oauth2
Token is: https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer
Not sure if this is possible directly. If not, you need to create your own step by step like you started but actually, you are missing the authorize part (and store the response with the current user…)

Thanks @Jici,
yes, have already built the app in QB dev, done the initialisation through a workflow in bubble (see below) and obtained the necessary code to access my QB built dev app!!
here is the workflow…
08%20am
the code is then stored and used in the API connector call

And why did you not try this in the oauth setting in API connector?

in order to refresh, prior to each new call…as the token only lasts 60mins

am i wrong in assuming that this needs to be refreshed in order to create a call after 60 minutes? ie. two days after the initialisation?

If you authenticate with oauth2 in Bubble, bubble will handle the refresh for you. But there’s case that this may not work. Never tested with this one.

1 Like

i see!
thanks heaps for the input, i’ll suss it out a little more and let you know if i have any success.

1 Like

Did you have any success with this API?

There’s a group of us trying this out on QuickBooks Integration - Follow Along as I Struggle [So You Don't Have To]

I made it work with the API Connector, but the refresh token doesn’t seem to stick. I’m wondering if it’s a API Connector bug or it’s a “feature” of Intuit’s. I’ve opened a ticket with Bubble to see if they could help me out.

@Jici you seem knowledgeable. Is it possible to debug the API Connector? Can I peep into the API Connector and try to figure out why it’s not saving the refresh_token?

1 Like

I don’t remember exactly for QBO but I’ve done this in the past. Actually I don’t have access to the app I’ve implemented this so I don’t remember if I use the native API Connector oAuth2 process or a manual one.

Do you have more than 1 oAuth2 for your user in this app? Example, a user create an account using Google Auth and can also connect with QBO Auth? If this is the case, it won’t work because Bubble can only handle one refresh token for user from my old testing (it may have change since, but more than 18 month ago, I’ve tested this with 2 and 3 oAuth at the same time for the same user and found that Bubble doesn’t handle this correctly. But no problem once at a time).

I wasn’t even thinking about logging in with QBO. So, to answer your question, no is not for various login OAuth2s.

All I’m trying to accomplish is to have Bubble use my credentials to do some stuff in QBO.

You mentioned something about using Custom Token. I’ve done this successfully with Zoho in the past, but I can’t get it to work with QBO. Would you guess this is a good route for my case?

Not custom token but just manually handled. Mean that you call the Authorization link in a button and when it’s back in your Workflow, you use Get data from url and finally use API Call to Get Token. Store it in DB and manually refresh it using two ways: With a Backend workflow scheduled or with a condition that if the API call fail because of expired token, get a new one using the refresh token.

You can also get an access token there: https://developer.intuit.com/app/developer/playground
But I don’t remember if this will also provide a refresh token.
You need to store both in DB.

You cannot use the Bubble native oAuth2 because the refresh token is related to a specific user but from what I understand you will only use your own account. So you need to manually handle each part.

2 Likes

Good call @Jici
yes, @rico.trevisan this is the most foolproof way of running the refresh token; save it into your data (a single refresh token and a single auth/access code)


then use the returned access code in your call…

below is using bubbles api connector to refresh the token (make sure to save both the refresh token and auth access code in your workflows) and then use the auth code returned (with Bearer ) to create a user (or any calls) in QB:

This method is also working without fail for Xero!

1 Like

How did you end up setting up the access token call? I’m also getting the 415 Unsupported Media error and can’t figure it out.

Nevermind figured it out.

For anyone else running across this, here is how to set it up:

Here is the body code:
code=<code>&redirect_uri=<redirect_uri>&grant_type=authorization_code

Also, the Authorization header is constructed as follows:

Basic base64encode(client_id:client_secret)

Hopefully, that saves someone some time.

2 Likes