Questions about linking oAuth to User

This is probably more a quesiton for @emmanuel or @josh

Let’s say a new user signs up using the Bubble signup form. Then, in order to import the user’s emails from Office365, we have the user authenticate through oAuth.

  • How does the oAuth become linked to the logged in user?
  • Is bubble storing the authentication in the user record?
  • Is there a way to allow the user to disassociate the authentication?
  • Is there a way to validate that they authenticated, in order to say something like “You’re authenticated” or do other actions? It does appear this is possible, disregard.

So this should cover most questions

https://manual.bubble.is/working-with-data/the-user-type.html

There is currently no way to remove the association, the user would do it by disallowing the app on the other side (google, for instance).

1 Like

Thanks @emmanuel! This paragraph was very helpful.

Users in Bubble can use traditional logins and social logins at the same time. There are a few cases here.

  1. If the user is currently logged in with email and password, you can prompt them to link their account with an Oauth provider (such as Facebook, Google…). If a user goes through such a flow, a new user will not be created, but, instead, the Oauth credentials will be added to the current, logged-in user. After this flow completes, the user will be able to login either with his email/password, or via an Oauth flow. If another user exists in the database with the email provided by the external service, the action will fail and a message will be shown to the user.
  2. If the user isn’t logged in when he goes through an Oauth flow, a new user will be created, except if a user with the same email (the email registered with Facebook) already exists in the app’s database. In such a case, the workflow will fail and a message will be shown to the user.
  3. If a user has signed up with an external service and wishes to add a password to his account, he can do this by going through a ‘reset the user’s password’ action. This will effectively modify the user that was authenticating only with Oauth credentials and will the email and password values to the user object.

@Kfawcett @emmanuel just wondering if you managed to put this into practice.

Specifically I’m finding that in when I am signed in as the current user and then connect via oauth flow to access data from an external api, when i am returned back to the bubble page via the URL redirect, the database creates a new user which I in contradiction to to the below from the reference manual.

Which seems to be direct contradiction to the below;

If the user isn’t logged in when he goes through an Oauth flow, a new user will be created, except if a user with the same email (the email registered with Facebook) already exists in the app’s database. In such a case, the workflow will fail and a message will be shown to the user.

@stevenrichardlevy hello Steven, I was wondering if you came across a possible solution.

I’m having the exact same problem, when the user is already logged in and goes through an Oauth flow (implemented with the API Connector), it simply creates a new user and automatically logs in with it.

Currently the logged in user simply clicks on a “Social Media” button that has a “Signup/Login with social network” flow.

It would be great to have any type of feedback :slight_smile: Cheers!

This could be a defect, although would need Bubble to review. I would submit a ticket if you haven’t resolved it. Otherwise, I think the text from the manual is specifically talking about using Facebook or another oAuth provider to create the initial account.

I think your use case is slightly different (i.e. User already created, but now you want to connect to an additional provider to interact with 3rd party data.) and this is where you’re encountering issues?

This is an old thread but I am having the same issue and don’t see the solution: there is a list of users already in bubble, and when that user logs un using Google, bubble creates a new user with the same e-mail address. I want to allow a user to login with EITHER username and password OR Google. Any help would be appreciated… I can do it by getting he users to login traditionally first, THEN logging into Google while still logged in traditionally. After that, the accounts are linked but I can’t find a way to do it if the user is logged out.