Pathfix allows you to add multiple connections against a single user. E.g 2 Twitter accounts or add 3 GMail accounts etc.
For Bubble users, Pathfix will render the auth UI and manage the connections for these multiple accounts. The process to Make Request in Bubble is slightly more complex but this documentation will walk you through the process.
Please note: For Bubble multi-connection auth, there is a new user concept called Virtual User ID. Virtual User ID's help associate each connected account for the user in case of multi-accounts.
Once you have registered your application with the provider you wish to integrate with:
- Login to your Pathfix account and click on Add Application
- Add the name of your web app and hit Save
- Select the provider you want to offer the integration from the list of providers. You can change the Display Name and Description in the General tab.
- Enter the Client ID and Client Secret received from provider and hit Save
- Copy your Pathfix Public Key and Private Key for use in the plugin
The Bubble auth UI is handled by Pathfix through our Pathfix OAuth Connector plugin.
- Install the Pathfix OAuth plugin
- If you already have the plugin installed, make sure you are on version 2.4.1 or above
- Add your Pathfix Public Key under the Public Key section
- Under x-partner-key, add your Pathfix public key and private key separate by a dot (). If you do not have a Pathfix account, enter the x-partner-key provided by the plugin in Bubble preview mode.
- Add the element to your page and select All Providers configured in my Pathfix Account
- Enable Multiple Connections per user
Image: Enable multi connection
You will now see the the provider auth button listed with the ability for your users to connect multiple accounts.
Image: Multi connection UI
For every user that connects multiple accounts for a single provider, Pathfix assigns a . This Virtal User ID needs to be used across all your API calls, including workflow setup.
To get the Virtual User ID, you will need to setup the following workflow in Bubble.
On the page where you want to call the API, you need to do the following steps:
- Get the list of connection names that have been authorized by the user
- Pick a connection from the list for which you want to retrieve the Virtual User ID
- Store the Virtual User ID to replace the user_id parameter in all your API calls
1.To get the list of connection names:
- For the page where you want to to invoke the API, go to Workflow
- This will insert the list of connection names in a Bubble state
Image: Get Connection Names
2. Pick a connection from the list for which you want to retrieve the Virtual User ID:
- You can offer your user to select from their multiple connections anywhere on your app.
- Below is a sample configuration for a dropdown:
Image: Dropdown multi connection
When the user makes a selection, you will need to setup a new workflow:
- Setup Step 1 to as shown below:
Image: Setup Query Connection Property
3. Store the Virtual User ID to replace the user_id parameter in all your API calls
- Add another workflow and choose the Pathfix Connector's is not empty
- This will generate the Virtual User ID that you can save to your database or use however you want
Image: Requested Connection Property