I have built this call in Postman and transferred it over to the Bubble but I keep getting the following error.
This call is for sending currency (including 2fa) with coinbase. All my other coinbase API’s are fine.
I have tried a few things (including rebuilding the call) but nothing seems to work? I wonder if it is the double - in the call?
It’s telling you your value for CB-2FA-Token isn’t correct. And in your second screenshot it’s empty. It wants a value for that.
Typically the Authorization key would not have “Bearer Bearer xyz…” It is normally “Bearer xyz…”
Also that. Good eye, @mebeingken!
Hey @keith ,
Thanks for the response. There is normally a response key there and the calls all work in Postman so I know that CB-2FA-token is the correct call. I think there is just a problem with the API connector handling that call
@mebeingken Yeah thanks for noticing, that was just a copy and paste error, I recreated my call just to take a screenshot.
Ok well it’s your API Call. But as Ken sez, your auth parameter is wrong. And as I sez, once u fix that, you will get thrown an error because the token is empty.
So basically your Bubble call IS NOT ANYTHING LIKE your Postman call. That’s your problem, most like.
Unless YOU HAVE ALSO forgotten to include the Content-type header. In which case fix that and you’ll still have the other 2 errors… just fix all that. If it’s still broken then we can talk, right?
I think I get where your head is at: You think the following…
“All I have to do is ‘initialize this API Call from anywhere.’”
That’s NOT what you have to do.
What you have to do is STRUCTURE Bubble’s call to duplicate what Postman is doing for you. Postman is very very nice to you and does a bunch of stuff for you that it’s easy to forget it’s doing for you. (Like setting Content-type header.)
I’ll make a goof-proof video about this someday, but in the meantime, think differently about what’s going on here. Your API Call structure in Bubble is simply NOTHING LIKE what Postman is doing for you.
The API is not magic. It does not KNOW what you did before. It is not sufficient to get it to execute once from anywhere and then you’re golden. That’s not the point.
Postman is only MARGINALLY helpful in getting an API going with Bubble. And it’s only helpful when you understand just what it is that Postman is doing for you. (Which is a bunch of stuff that you need to replicate in Bubble.)
In this thread, no less than THREE things of this nature have now been pointed out to you (wonky auth, missing parameter, possibly missing Content-type header)… and yet you are insisting things are great. But they are not working for you. There’s a reason for that (things are not set up right).
See where we’re going with this?
I discovered the problem, The bubble API connector will not allow for numbers to be anywhere in the header key. Hence why CB-2FA-TOKEN wouldn’t work. Good to know for future API calls.
Thanks for the continued responses. As I noted above I have fixed all of the errors I made when copying over the call (I did it quickly just to get the screenshot). I understand that API’s made in postman mean nothing to API calls made in Bubble. By saying the calls work in Postman I am simply saying that CB-2FA-Token header is correct. Please correct me if I am wrong, but the error I am getting is not an API response error. Bubble is stopping my call from even being made in the first place.
I think what makes this call unique, is that to authenticate this call, coinbase requires you to use their two-factor-authentication system. According to their documentation, you are supposed to make the call twice, one with an empty CB-2FA-Token header (where Coinbase will respond with a status code somewhere in the 400’s) and then make it again once you enter in a code sent via sms to the users phone.
If I remove the CB-2FA-Token header entirely the call works and I receive the 402 status code as expected. The problem is once I add the CB-2FA-Token (including the 2FA number as the value) bubble gives an error (not Coinbase sending back another error). I noticed other people have run into similar problems with other API calls which is why I submitted it as a bug. But @keith you appear to be an expert so again maybe I am missing something particular. Below is my updated call which returns the same error.
You might be running into the issue where removing and adding headers can cause the API call definition to be corrupted. To get around this, its easiest to recreate the call.
As Bubble can’t turn the header off and on, you’ll likely need two calls defined, one without the header to start the 2FA, and one to send the code.
The first call will always return the 402 error, which makes it hard to get initialised to be usable. The API connector can be convinced that it is a valid call if it sees an OK response, to do this you can temporarily set the URL to another API that always returns OK, initialise it, then set the url back to where it belongs.
This topic was automatically closed after 14 days. New replies are no longer allowed.