Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore: updates gotrue docs to latest

awalias56ab91425f4c
diff --git a/web/docs/gotrue/server/about.md b/web/docs/gotrue/server/about.md
index 3aa87e4afd6..3d6c99e8e58 100644
--- a/web/docs/gotrue/server/about.md
+++ b/web/docs/gotrue/server/about.md
@@ -233,6 +233,10 @@ Email subject to use for signup confirmation. Defaults to `Confirm Your Signup`.
Email subject to use for password reset. Defaults to `Reset Your Password`.
+`MAILER_SUBJECTS_MAGIC_LINK` - `string`
+
+Email subject to use for magic link email. Defaults to `Your Magic Link`.
+
`MAILER_SUBJECTS_EMAIL_CHANGE` - `string`
Email subject to use for email change confirmation. Defaults to `Confirm Email Change`.
@@ -279,6 +283,20 @@ Default Content (if template is unavailable):
<p><a href="{{ .ConfirmationURL }}">Reset Password</a></p>
```
+`MAILER_TEMPLATES_MAGIC_LINK` - `string`
+
+URL path to an email template to use when sending magic link.
+`SiteURL`, `Email`, and `ConfirmationURL` variables are available.
+
+Default Content (if template is unavailable):
+
+```html
+<h2>Magic Link</h2>
+
+<p>Follow this link to login:</p>
+<p><a href="{{ .ConfirmationURL }}">Log In</a></p>
+```
+
`MAILER_TEMPLATES_EMAIL_CHANGE` - `string`
URL path to an email template to use when confirming the change of an email address.
@@ -340,6 +358,14 @@ GoTrue exposes the following endpoints:
* **POST /invite**
Invites a new user with an email.
+ This endpoint requires the `service_role` or `supabase_admin` JWT set as an Auth Bearer header:
+
+ e.g.
+ ```json
+ headers: {
+ "Authorization" : "Bearer eyJhbGciOiJI...M3A90LCkxxtX9oNP9KZO"
+ }
+ ```
```json
{
@@ -362,14 +388,13 @@ GoTrue exposes the following endpoints:
* **POST /verify**
- Verify a registration or a password recovery. Type can be `signup` or `recovery`
+ Verify a registration or a password recovery. Type can be `signup` or `recovery` or `invite`
and the `token` is a token returned from either `/signup` or `/recover`.
```json
{
"type": "signup",
- "token": "confirmation-code-delivered-in-email",
- "password": "12345abcdef" // only required if responding to an 'invite'
+ "token": "confirmation-code-delivered-in-email"
}
```
@@ -382,34 +407,62 @@ GoTrue exposes the following endpoints:
"access_token": "jwt-token-representing-the-user",
"token_type": "bearer",
"expires_in": 3600,
- "refresh_token": "a-refresh-token"
+ "refresh_token": "a-refresh-token",
+ "type": "signup | recovery | invite"
}
```
* **GET /verify**
- Verify a registration or a password recovery. Type can be `signup` or `recovery`
- and the `token` is a token returned from either `/signup` or `/recover`.
+ Verify a registration or a password recovery. Type can be `signup` or `recovery` or `magiclink` or `invite`
+ and the `token` is a token returned from either `/signup` or `/recover` or `/magiclink`.
+ query params:
```json
{
"type": "signup",
"token": "confirmation-code-delivered-in-email",
}
```
-
- `password` is required for signup verification if no existing password exists.
User will be logged in and redirected to:
```json
- SITE_URL/#access_token=jwt-token-representing-the-user&token_type=bearer&expires_in=3600&refresh_token=a-refresh-token
+ SITE_URL/#access_token=jwt-token-representing-the-user&token_type=bearer&expires_in=3600&refresh_token=a-refresh-token&type=invite
```
+ Your app should detect the query params in the fragment and use them to set the session (supabase-js does this automatically)
+
+ You can use the `type` param to redirect the user to a password set form in the case of `invite` or `recovery`,
+ or show an account confirmed/welcome message in the case of `signup`, or direct them to some additional onboarding flow
+
+* **POST /magiclink**
+
+ Magic Link. Will deliver a link (e.g. `/verify?type=magiclink&token=fgtyuf68ddqdaDd`) to the user based on
+ email address which they can use to redeem an access_token.
+
+ By default Magic Links can only be sent once every 60 seconds
+
+ ```json
+ {
+ "email": "[email protected]"
+ }
+ ```
+
+ Returns:
+
+ ```json
+ {}
+ ```
+
+ when clicked the magic link will redirect the user to `<SITE_URL>#access_token=x&refresh_token=y&expires_in=z&token_type=bearer&type=magiclink` (see `/verify` above)
+
* **POST /recover**
Password recovery. Will deliver a password recovery mail to the user based on
email address.
+
+ By default recovery links can only be sent once every 60 seconds
```json
{
@@ -539,6 +592,7 @@ GoTrue exposes the following endpoints:
Redirects to `<GOTRUE_SITE_URL>#access_token=<access_token>&refresh_token=<refresh_token>&expires_in=3600&provider=<provider_name>`
+
## Pre-built
- [Docker](https://hub.docker.com/repository/docker/supabase/gotrue)