Adding a new OAuth2 login


I’m building a flow to allow a user to login / sign up using Xero (the accounting service). I’ve done a bit of work already using their API on my bubble app, including using their OAuth2 flow to link a user and handle operations / POSTs to their account etc.

I am now trying to allow the user to log in to my app (bubble) using their Xero credentials, and I’ve come pretty far in the process. I can get the encrypted JWT back from xero, decode it, and verify the user against my DB. The problem I’m facing now is how to actually log the user in on Bubble. Obviously there are already made plugins for some services (not for Xero yet), and I’ve looked at the way that @romanmg set up some of theirs, but it seems like the Xero code flow is slighlty different?

The xero code flow in a nutshell:

  1. Send the user to xero, they log in and send the user back with a “code=xxxx” parameter in the URL and scope etc
  2. I then do a POST call using that received parameter (“code=xxxx”) and some credentials and get back the tokenID
  3. tokenID is a JWT containing the user credentials

I’ve now managed to get all of this to work via API calls and a little plugin that I built to decode the JWT.

Do I have to go via the route of building a plugin, marking it as social network, and will Bubble then allow me the option to use that in my workflow?