Capturing User Consent
When using the Pathfix Custom oauth option, there may be times when you may need to capture the user consent status (if they have connected their accounts or not).
The following documentation walks you through on checking and updating the user consented status against your user in bubble.io
Depending on the method you are using, you will see the Consented event option show up as either PathfixCustom (for those that have chosen to use a custom oauth button) or Pathfix Connector ([default] for those who use Pathfix rendered OAuth buttons).
Start by adding a custom text field to your user data to save the user status:
- In Bubble.io, go to Data and User data
- Click on Create a new field and add the provider name
After you have set up your oauth connect buttons (Pathfix rendered buttons or your own custom oauth button) add the following workflows:
In this example, we will go through the process using Google Calendar as an example.
This workflow will check the consented status (where the user is connected)
- Add new workflow
- Elements -> Pathfix Custom User Consented
- Step 1 would be to Make changes to current user
- Click on the + Change another field
- Select the created Custom field Google connected is equal to yes
- Add a condition to change Only when the consented provider matches (in this example we have used googlecalendar)
Note: If you are working with more than 1 provider, you can add additional Step's and repeat the same condition
This workflow will check if the user connection has disconnected the provider from your app.
- Add new workflow
- Elements -> Pathfix Custom Disconnected
- Step 1 would be to Make changes to current user
- Click on the + Change another field
- Select the created Custom field Google connected is equal to no
- Add a condition to change Only when the consented provider matches (in this example we have used googlecalendar)
Note: If you are working with more than 1 provider, you can add additional Step's and repeat the same condition
You can add workflows to show/hide elements on your page depending on the user's consented status for a provider.
Example: show the Disconnect button if the user is connected and hide the Connect button.
Show Connect button if the user is disconnected and hide the Disconnect button
The Consented status updates automatically based on the connection status of the user. No additional calls need to be made.
Need help? Reach out to us at [email protected] and we would be happy to assist!