Social Login Only If User Already Registered

Is there a way to only log the user in with Facebook (or Google) if they are already a user? I suspect that I may be overcomplicating things for myself so I should probably give some background.

My app has two types of user - parents and children. Only parents can sign up. So they sign themselves up as well as their child.

So I have a sign-up page that includes an “I’m a parent” checkbox which the user has to tick before they can sign-up with a social button or email.

The issues I have are with the login flow.
a) If a person that is not already registered clicks on the Facebook button to login, an account is created for them. I don’t want this, as the user ends up with incomplete information. In my case, it does not make sense to repeat the full registration process every time a user logs in. So I would like to check if the Facebook user is already registered before I log them in. If not, send them to register. Is there a way to do this? What have you done in your app to send the user down different paths with social login/register, depending on whether they are a new or an existing user?

@romanmg, as someone who has implemented several oAuth plugins, I was wondering if you had a view? Perhaps it is possible to create a plugin that separates the login and register actions of say Facebook oAuth?

b) I also want to prevent a child from login in with social. To prevent this I have two login forms - the child one has no social login buttons, but I worry that a child could do parent login and end up with parent privileges. This is a secondary issue, but a solution to issue ‘a’ above would probably also solve this.

By the way, one idea I have is to copy the list of all existing users then log the user in. If their email is not in the copied list, it means they are not a registered user. I can then delete the new user and send them to register. Seems like overkill to me though and potentially a waste of workflows.

1 Like

Did you try checking the box that returns the user thing if the account already exists?
That’s what I use to check if the user is already registered.

1 Like

Hi @john3, thanks - I was about to say that this doesn’t apply in my case, but can you tell me more please about your workflow? In the first step of the workflow in your screenshot, you have signup/login with Facebook action - this immediately adds the Facebook user to your database, right? Then the same user is updated in the second step, even though the step says "Create an account for someone else?

That’s an interesting approach. In my signup flow, my first step is the same as yours but the second step is a “Make changes to a thing (current user)” action.

So with your approach, one could use the same action for both signup and login, right? It still wouldn’t stop the rest of my signup flow from running at login though, e.g. if I wanted the user taken to a different page/group at sign-up than at login. How are you handling that.

Thanks for this though. It certainly looks like another option to play with.

You should add conditionals to the rest of your signup flow that will stop it from running at login if they are not already registered and add more steps to the flow to define what happens next.

Just run a check to see if the profile fields you require have been filled out for the current user. If they haven’t redirect them to a form to fill out the info. So if a user logs in for the first time with Facebook, they will be redirected to a form that gets the information you seek, and then adds it to the user record so that next time they log in with Facebook, the check will come back good and user will login without the addition form step.

They signup/login with Facebook and you redirect them to a user area only if their age is verified.


You could also add the check on the members area page. If you are doing it as a single page app then it’s a bit different but same logic.

@marcusjamesreed, @john3, thanks. I guess I was hoping there was another built-in way.

@john3, the return user checkbox you mentioned is interesting, but I found something odd with it, or perhaps it’s just me not understanding what it is meant to do. Like the field level in your screenshot, I have a field called ‘plan’ that I set to basic for new users. If I set my workflow up like yours and I have an existing user whose plan has been upgraded to premium, when they login, the plan is being reset to basic. I thought the point of the checkbox was to spot that the user already existed and therefore not update the record but instead return the user for use in subsequent workflow steps. Do you see the same behaviour? Is my understanding wrong?

Yes I think you’re misunderstanding it - the checkbox only lets you know that the user exists - you have to do something with it. It says it returns the user thing if the account already exists. It’s prudent to assume that in bubble the workflow logic is not set unless you specify it. So you need to setup a condition to check the appropriate user thing and prevent a workflow step from running or make a different workflow step run.

So in your case you should try to use the current user’s facebook’s email and see if it already exists as your condition - if true then don’t run your setup account stuff, if false then run it. However, just be aware not all FB accounts have an email set so it might be empty. That’s why I’m storing the Social ID key from FB - you can use that to run against a new user to see if they exist already. So far I think it’s ok but you may also need to ask them for their email if that doesn’t provide enough confirmation - then run that email against your database to see if it already exists.

Another way to avoid all this is to make sure you have a checkbox that says “stay logged in” and runs that workflow logic. That might help you reduce the incidents of double signups and overwrites.


Thanks @john3, I was going by the documentation, which implies that the checkbox returns the existing user so you can refer to them in subsequent workflow steps. I take your point though, it all has to be explicitly implemented.

I will work through it.

1 Like

Hey John,

I’m also trying to implement a LinkedIn login/signup but I can’t prevent the system from trying to create a new account every time. In my mind, I think the workflow that I have tries to log the user in, if the account exists - it returns the User then I pass that to the portal page. What happens instead is that it just says the email already exists. Any help you could provide (with screen shots) would be awesome! Thanks!


1 Like