Cleanup
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
---
|
||||
title: Authentication Overview
|
||||
label: Overview
|
||||
description: Learn how authentication works in MakerKit and how to configure it.
|
||||
---
|
||||
|
||||
The way you want your users to authenticate can be driven via configuration.
|
||||
|
||||
If you open the global configuration at `src/configuration.ts`, you'll find
|
||||
the `auth` object:
|
||||
|
||||
```tsx title="configuration.ts"
|
||||
import type { Provider } from '@supabase/gotrue-js/src/lib/types';
|
||||
|
||||
auth: {
|
||||
requireEmailConfirmation: false,
|
||||
providers: {
|
||||
emailPassword: true,
|
||||
phoneNumber: false,
|
||||
emailLink: false,
|
||||
oAuth: ['google'] as Provider[],
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
As you can see, the `providers` object can be configured to only display the
|
||||
auth methods we want to use.
|
||||
|
||||
1. For example, by setting both `phoneNumber` and `emailLink` to `true`, the
|
||||
authentication pages will display the `Email Link` authentication
|
||||
and the `Phone Number` authentication forms.
|
||||
2. Instead, by setting `emailPassword` to `false`, we will remove the
|
||||
`email/password` form from the authentication and user profile pages.
|
||||
|
||||
## Requiring Email Verification
|
||||
|
||||
This setting needs to match what you have set up in Supabase. If you require email confirmation before your users can sign in, you will have to flip the following flag in your configuration:
|
||||
|
||||
```ts
|
||||
auth: {
|
||||
requireEmailConfirmation: false,
|
||||
}
|
||||
```
|
||||
|
||||
When the flag is set to `true`, the user will not be redirected to the onboarding flow, but will instead see a successful alert asking them to confirm their email. After confirmation, they will be able to sign in.
|
||||
|
||||
When the flag is set to `false`, the application will redirect them directly to the onboarding flow.
|
||||
|
||||
## Emails sent by Supabase
|
||||
|
||||
Supabase spins up an [InBucket](http://localhost:54324/) instance where all the emails are sent: this is where you can find emails related to password reset, sign-in links, and email verifications.
|
||||
|
||||
To access the InBucket instance, you can go to the following URL: [http://localhost:54324/](http://localhost:54324/). Save this URL, you will use it very often.
|
||||
30
apps/web/content/docs/002-authentication/002-setup.mdx
Normal file
30
apps/web/content/docs/002-authentication/002-setup.mdx
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
title: Supabase Setup
|
||||
label: Supabase Setup
|
||||
description: How to setup authentication in MakerKit using Supabase.
|
||||
---
|
||||
|
||||
Supabase needs a few settings to be configured in their Dashboard to work correctly. This guide will walk you through the steps to get your Supabase authentication setup.
|
||||
|
||||
## Authentication URLs
|
||||
|
||||
The first thing you need to do is to set the authentication URLs in the Supabase Dashboard. These URLs are used to redirect users to the correct page after they have logged in or signed up.
|
||||
|
||||
1. Go to the [Supabase Dashboard](https://app.supabase.io/).
|
||||
2. Click on the project you want to use.
|
||||
3. Go to the **Authentication** tab.
|
||||
4. Click on **URL Configuration**.
|
||||
5. Add your Site URL to the **Site URL** field. This is the URL of your MakerKit site (e.g. `https://my-site.com`).
|
||||
6. Add your Redirect URLs to the **Redirect URLs** field. You need to add at least two URLs: This is the URL of your MakerKit site with `/auth/callback` appended to it (e.g. `https://my-site.com/auth/callback`) and another for redirecting users to their password reset page (e.g. `https://my-site.com/settings/profile/password`).
|
||||
|
||||
## Custom SMTP (optional)
|
||||
|
||||
If you want to send emails from your own domain, you can configure your SMTP settings in the Supabase Dashboard.
|
||||
|
||||
This is optional, but recommended if you want to send emails from your own domain.
|
||||
|
||||
1. Go to the [Supabase Dashboard](https://app.supabase.io/).
|
||||
2. Click on the project you want to use.
|
||||
3. Go to the **Project Settings** tab.
|
||||
4. Click on **Auth**.
|
||||
5. Tweak the `SMTP Settings` settings to your liking according to your provider's documentation.
|
||||
23
apps/web/content/docs/002-authentication/index.mdx
Normal file
23
apps/web/content/docs/002-authentication/index.mdx
Normal file
@@ -0,0 +1,23 @@
|
||||
---
|
||||
title: Authentication
|
||||
label: Authentication
|
||||
description: Learn everything about Authentication in Makerkit
|
||||
---
|
||||
|
||||
MakerKit uses Supabase to manage authentication within your application.
|
||||
|
||||
By default, every kit comes with the following built-in authentication methods:
|
||||
- **Email/Password** - we added, by default, the traditional way of signing in
|
||||
- **Third Party Providers** - we also added by default Google Auth sign-in
|
||||
- **Email Links**
|
||||
- **Phone Number**
|
||||
|
||||
You're free to add (or remove) any of the methods supported by Supabase's
|
||||
Authentication: we will see how.
|
||||
|
||||
This documentation will help you with the following:
|
||||
- **Setup** - setting up your Supabase project
|
||||
- **SSR** - use SSR to persist your users' authentication, adding new
|
||||
providers
|
||||
- **Customization** - an overview of how MakerKit works so that you can adapt
|
||||
it to your own application's needs
|
||||
Reference in New Issue
Block a user