Account Linking
gau
has an automatic account linking feature, configured via the autoLink
option in createAuth
.
When multiple OAuth providers are configured and an existing user signs in with a new provider, gau
will try to link the new account to the existing user.
How It Works
Section titled “How It Works”-
Check for Existing Account: It first checks if an account already exists for that user with the specific OAuth provider. If so, it logs them in.
-
Check for Email to Link: If no existing account is found,
gau
looks at the email address returned by the new OAuth provider. It then checks if any user in your database already has that email address. -
Link or Create:
- If a user with that email already exists,
gau
will link the new OAuth sign-in to that existing user record. - If no user with that email is found, a new user is created.
- If a user with that email already exists,
This means a user can sign in with GitHub, sign out, and then sign back in with Google, and they will be logged into the same account, as long as both services use the same verified email address.
Config
Section titled “Config”See the autoLink
option in the configuration guide.