Oauth 2.0 User-Agent Flow

I’m trying to connect now to the GitHub API, as well as allowing GitHub as a login provider. Using the User-Agent Flow, I get the error:
“Workflow error - API Connector error: the Oauth2 API GitHub API Connector is not configured properly - Received error from api”

In order to fix this, I’m really going to need to see what error the API returned. With all filters enabled, the server logs still don’t show anything but the above. How can I see the error? How can I see the content of GitHub’s response?

You should share your API Connector configuration. It will be easier to help.

Sure. This is what I have.

This is following oauth2-user-agent-flow from the Manual though most of the fields are not described there, so aside from trial and error, seeing the actual response from GitHub would probably be the best way forward.

This is all the server log shows:

So it looks like API Connector has been able to POST the authorize request, and received an access token. The error seems to be at the final stage, where we GET from user (Ilya Solovyov) · GitHub.

Here’s how I solved it. I couldn’t see what Bubble was sending to GitHub, or what GitHub was responding. So I implemented a “man-in-the-middle”:

  • On an http server I controlled, I set up a program (in this case HTTP Debugger) that intercepts http calls and outputs them to the screen.
  • I put my own server’s URL into the “User profile endpoint” in the API Connector form.
  • I then copied the headers that Bubble sent into Postman and debugged the request.

From this I learned that:

  • GitHub expects the Authorization to be in the form “Bearer [token]”, where by default Bubble sends “token [token]” - so the Header key was changed to “Authorization: Bearer”
  • GitHub expects a header with the key “User-Agent”, and Bubble does not send this by default. It seems it doesn’t matter what value is assigned.
  • The undocumented field “User ID key path” means “what key in the returned JSON corresponds to the Bubble site user id that should be used or created to log in”. So in this case the default “id” works for GitHub.