Setting your authentication configuration
Learn how to setup the authentication configuration of your Remix Supabase application
Makerkit supports three different authentication methods:
- Password - the traditional email/password method, set to
true
by default - Magic Link - magic link, set to
false
by default - oAuth - oAuth providers, by default we set Google Auth
The authentication configuration is set at apps/web/config/auth.config.ts
.
The recomendation is to not update this directly - instead, please define the environment variables below and override the default behavior. The configuration is validated using the Zod schema AuthConfigSchema
, so if something is off, you'll see the errors.
const authConfig = AuthConfigSchema.parse({ // NB: This is a public key, so it's safe to expose. // Copy the value from the Supabase Dashboard. captchaTokenSiteKey: import.meta.env.VITE_CAPTCHA_SITE_KEY, // NB: Enable the providers below in the Supabase Console // in your production project providers: { password: import.meta.env.VITE_AUTH_PASSWORD === 'true', magicLink: import.meta.env.VITE_AUTH_MAGIC_LINK === 'true', oAuth: ['google'], },} satisfies z.infer<typeof AuthConfigSchema>);
For example, if you wanted to switch from password auth to magic link, you'd set the below variables:
VITE_AUTH_PASSWORD=falseVITE_AUTH_MAGIC_LINK=true
Password Requirements
To set the password requirements, you can set the following environment variables:
VITE_PASSWORD_REQUIRE_UPPERCASE=trueVITE_PASSWORD_REQUIRE_NUMBERS=trueVITE_PASSWORD_REQUIRE_SPECIAL_CHARS=true
The above will enforce the following rules:
- At least one uppercase letter
- At least one number
- At least one special character