Instagram oauth api works great in postman, but the api connector gives a invalid authorization code error

I had been working on getting the api connector to give me an access token when feeding it authorization code for days and could only get a “400 invalid authorization token” error. Then I thought, let’s try in postman. It worked first try.

I’m following everything the instagram documentation says to do - Business Login for Instagram - Instagram Platform - Documentation - Meta for Developers

Obviously it works cause it works in postman. . . . so the question; how do I get the bubble api connector to do whatever postman is doing to feed the valid auth token?

Can you share what you did in postman and api connector and also where is the error? (is it before you go to the login page or after… and if after, is it after the redirection and the error come from Bubble?)

Just updated the post with screenshots - error is after I the login screen, the instagram redirect uri is appended with the access code, which is a parameter when swapping the code for an auth token.

So you are doing the manual process and not the user-agent Bubble auth.
Remove & at the beggining of your body. This is not needed and probably create issue.
Which error do you get when you try to intialize the token call?

Also, did you set none/selfhandled for the auth part?

removed the & at the beginning, still no luck.

When I try and initialize the call, I get the error in the second screenshot.

I’m not using the user-agent bubble auth, so I’m assuming that’s the manual process. - yes using non-self handled for the auth. I’ll try tweaking some of those settings.

Sorry didn’t see the error. Are you really fast to copy the authorization code in api connector?

yep, I get a different error if the auth code has expired

1 Like

Try to use a tool like requestbin to compare the request in postman vs in Bubble. Also, be sure to not have shared headers that could create a conflict with the one set in call

You could also try the request in the url instead of body, however, it doesn’t make sense according to postman screenshot

definitely a difference in the headers that bubble is sending vs. postman. Anyone know what the required headers are for instagram?

Not sure what or why — but I deleted the call I had from the api connector plugin and started from scratch. . . . and it worked. the ole unplug it and plug it back in trick. . . .

1 Like

Sometimes, when you change the call often (add, remove fields/headers, shared stuff) this create this kind of issue. Happy that you get it working.

Hey,

I’m using Instagram API with Instagram login in my app.

This setup works.

You have to remove the “#_” at the end of the code that Instagram is sending back to you.

Hope you it can help you.