Identity linking

This is a similar feature just like how Bubble operates with Oauth providers. If you're logged out, and you've only signed up with email, the next time you're logging in via Google, it will automatically create a new user. However once you Signin via an Oauth provider and you're also logged in, that login will be attached to your User profile.

This is the same in Supabase. Identity Linking allows you to attach any Oauth provider to a User and the next time they login with that, they'll be authenticated as the same user. However we need to link them first.

Retrieve identities linked to a user

This action retrieves all identities linked to a user (which is your Current User). The output will be a Bubble List of Text with the following format as each row:

identity_data.email,identity_data.sub,last_sign_in_at,provider,identity_id As you can see it's a comma separated list, with the relevat info, and each row will contain thes same set of values. What is each value:

  • identity_data.email: the email user for signing in.

  • identity_data.sub: the unique id of the provider itself.

  • last_sign_in: a iso date when the user last signed in using the identity

  • provider: for example: google or email.

  • identity_id: that's the uuid in our table within Supabase.

Within each row, use the :splitby operator and find the relevant item you'd like to reference.

The Enable Manual Linking option must be enabled from your project's authentication settings. Once this action called, the same action will happen as the regular "Sign in through OAuth", you'll also have the same options, the only difference will be the event triggered: "New Identity has been linked to User"

If the user tries to link a Google account which has already been used for authentication for themself or for other users, the linking action will fail.

For whatever reason you'd like to do this, you can unlink any identity from a user, just by providing what social login provider was used, and the plugin will unlink it from the user. But it won't log them out.

If your user logged in with Google, and doesn't have any other identity

Let's say your user logged in with Google, and doesn't have any other identity. If you try to unlink Google it will throw an error: User must have at least 1 identity after unlinking

Last updated