Add OTP sign-in option + Account Linking (#276)

* feat(accounts): allow linking email password
* feat(auth): add OTP sign-in
* refactor(accounts): remove 'sonner' dependency and update toast imports
* feat(supabase): enable analytics and configure database seeding
* feat(auth): update email templates and add OTP template
* feat(auth): add last sign in method hints
* feat(config): add devIndicators position to bottom-right
* feat(auth): implement comprehensive last authentication method tracking tests
This commit is contained in:
Giancarlo Buomprisco
2025-06-13 16:47:35 +07:00
committed by GitHub
parent 856e9612c4
commit 9033155fcd
87 changed files with 2580 additions and 1172 deletions

View File

@@ -15,6 +15,12 @@ const AuthConfigSchema = z.object({
description: 'Whether to display the terms checkbox during sign-up.',
})
.optional(),
enableIdentityLinking: z
.boolean({
description: 'Allow linking and unlinking of auth identities.',
})
.optional()
.default(false),
providers: z.object({
password: z.boolean({
description: 'Enable password authentication.',
@@ -22,6 +28,9 @@ const AuthConfigSchema = z.object({
magicLink: z.boolean({
description: 'Enable magic link authentication.',
}),
otp: z.boolean({
description: 'Enable one-time password authentication.',
}),
oAuth: providers.array(),
}),
});
@@ -35,11 +44,17 @@ const authConfig = AuthConfigSchema.parse({
displayTermsCheckbox:
process.env.NEXT_PUBLIC_DISPLAY_TERMS_AND_CONDITIONS_CHECKBOX === 'true',
// whether to enable identity linking:
// This needs to be enabled in the Supabase Console as well for it to work.
enableIdentityLinking:
process.env.NEXT_PUBLIC_AUTH_IDENTITY_LINKING === 'true',
// NB: Enable the providers below in the Supabase Console
// in your production project
providers: {
password: process.env.NEXT_PUBLIC_AUTH_PASSWORD === 'true',
magicLink: process.env.NEXT_PUBLIC_AUTH_MAGIC_LINK === 'true',
otp: process.env.NEXT_PUBLIC_AUTH_OTP === 'true',
oAuth: ['google'],
},
} satisfies z.infer<typeof AuthConfigSchema>);