Skip to content

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

Update prettier formatting

Andrew Smithd75e98e55b2d
diff --git a/apps/docs/pages/guides/auth/server-side/email-based-auth-with-pkce-flow-for-ssr.mdx b/apps/docs/pages/guides/auth/server-side/email-based-auth-with-pkce-flow-for-ssr.mdx
index 208660ed982..777308c8a7f 100644
--- a/apps/docs/pages/guides/auth/server-side/email-based-auth-with-pkce-flow-for-ssr.mdx
+++ b/apps/docs/pages/guides/auth/server-side/email-based-auth-with-pkce-flow-for-ssr.mdx
@@ -2,53 +2,36 @@ import Layout from '~/layouts/DefaultGuideLayout'
export const meta = {
title: 'Email Auth with PKCE flow for SSR',
- description: 'Learn how to configure email authentication in your server-side rendering (SSR) application to work with the PKCE flow.',
+ description:
+ 'Learn how to configure email authentication in your server-side rendering (SSR) application to work with the PKCE flow.',
}
### Install Supabase Auth Helpers
The Auth Helpers will assist you in implementing user authentication within your server-side rendering (SSR) framework.
-<Tabs
- scrollable
- size="small"
- type="underlined"
- defaultActiveId="nextjs"
->
-<TabPanel id="nextjs" label="NextJS">
-```bash
-npm install @supabase/auth-helpers-nextjs @supabase/supabase-js
-```
-</TabPanel>
-<TabPanel id="sveltekit" label="SvelteKit">
-```bash
-npm install @supabase/auth-helpers-sveltekit @supabase/supabase-js
-```
-</TabPanel>
+<Tabs scrollable size="small" type="underlined" defaultActiveId="nextjs">
+ <TabPanel id="nextjs" label="NextJS">
+ ```bash npm install @supabase/auth-helpers-nextjs @supabase/supabase-js ```
+ </TabPanel>
+ <TabPanel id="sveltekit" label="SvelteKit">
+ ```bash npm install @supabase/auth-helpers-sveltekit @supabase/supabase-js ```
+ </TabPanel>
</Tabs>
### Set environment variables
Create an `.env.local` file in your project root directory. You can get your `SITE_URL` and `ANON_KEY` from inside of the [dashboard](https://supabase.com/dashboard/project/_/settings/api).
-<Tabs
- scrollable
- size="small"
- type="underlined"
- defaultActiveId="nextjs"
->
-<TabPanel id="nextjs" label="NextJS">
-```bash .env.local
-NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
-NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
-```
-</TabPanel>
-<TabPanel id="sveltekit" label="SvelteKit">
-```bash .env.local
-PUBLIC_SUPABASE_URL=your_supabase_project_url
-PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
-```
-</TabPanel>
+<Tabs scrollable size="small" type="underlined" defaultActiveId="nextjs">
+ <TabPanel id="nextjs" label="NextJS">
+ ```bash .env.local NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
+ NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key ```
+ </TabPanel>
+ <TabPanel id="sveltekit" label="SvelteKit">
+ ```bash .env.local PUBLIC_SUPABASE_URL=your_supabase_project_url
+ PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key ```
+ </TabPanel>
</Tabs>
### Setting up the Auth Helpers
@@ -79,6 +62,7 @@ export async function middleware(req) {
return res
}
```
+
</TabPanel>
<TabPanel id="sveltekit" label="SvelteKit">
Create a new `hooks.server.js` file in the root of your project and populate with the following:
@@ -109,6 +93,7 @@ export const handle: Handle = async ({ event, resolve }) => {
})
}
```
+
</TabPanel>
</Tabs>
@@ -126,28 +111,29 @@ In order to use the updated email links we will need to setup a endpoint for ver
Create a new file at `app/auth/confirm/route.js` and populate with the following:
```js app/auth/confirm/route.js
-import { createRouteHandlerClient } from "@supabase/auth-helpers-nextjs";
-import { cookies } from "next/headers";
-import { NextResponse } from "next/server";
+import { createRouteHandlerClient } from '@supabase/auth-helpers-nextjs'
+import { cookies } from 'next/headers'
+import { NextResponse } from 'next/server'
export async function GET(req) {
- const { searchParams } = new URL(req.url);
- const token_hash = searchParams.get("token_hash");
- const type = searchParams.get("type");
- const next = searchParams.get("next") ?? "/";
+ const { searchParams } = new URL(req.url)
+ const token_hash = searchParams.get('token_hash')
+ const type = searchParams.get('type')
+ const next = searchParams.get('next') ?? '/'
if (token_hash && type) {
- const supabase = createRouteHandlerClient({ cookies });
- const { error } = await supabase.auth.verifyOtp({ type, token_hash });
+ const supabase = createRouteHandlerClient({ cookies })
+ const { error } = await supabase.auth.verifyOtp({ type, token_hash })
if (!error) {
- return NextResponse.redirect(new URL(`/${next.slice(1)}`, req.url));
+ return NextResponse.redirect(new URL(`/${next.slice(1)}`, req.url))
}
}
// return the user to an error page with some instructions
- return NextResponse.redirect(new URL('/auth/auth-code-error', req.url));
+ return NextResponse.redirect(new URL('/auth/auth-code-error', req.url))
}
```
+
</TabPanel>
<TabPanel id="sveltekit" label="SvelteKit">
Create a new file at `src/routes/auth/confirm/+server.js` and populate with the following:
@@ -175,6 +161,7 @@ export const GET = async (event) => {
throw redirect(303, '/auth/auth-code-error');
};
```
+
</TabPanel>
</Tabs>
@@ -188,7 +175,11 @@ Let's update the URL in our email templates to point to our new confirmation end
<h2>Confirm your signup</h2>
<p>Follow this link to confirm your user:</p>
-<p><a href="{{ .SiteURL }}/auth/confirm?token_hash={{ .TokenHash }}&type=email">Confirm your email</a></p>
+<p>
+ <a href="{{ .SiteURL }}/auth/confirm?token_hash={{ .TokenHash }}&type=email"
+ >Confirm your email</a
+ >
+</p>
```
**Invite user template**
@@ -196,9 +187,16 @@ Let's update the URL in our email templates to point to our new confirmation end
```html
<h2>You have been invited</h2>
-<p>You have been invited to create a user on {{ .SiteURL }}. Follow this link to accept the invite:</p>
+<p>
+ You have been invited to create a user on {{ .SiteURL }}. Follow this link to accept the invite:
+</p>
-<p><a href="{{ .SiteURL }}/auth/confirm?token_hash={{ .TokenHash }}&type=invite&next=/path-to-your-update-password-page">Accept the invite</a></p>
+<p>
+ <a
+ href="{{ .SiteURL }}/auth/confirm?token_hash={{ .TokenHash }}&type=invite&next=/path-to-your-update-password-page"
+ >Accept the invite</a
+ >
+</p>
```
**Magic Link template**
@@ -225,7 +223,12 @@ Let's update the URL in our email templates to point to our new confirmation end
<h2>Reset Password</h2>
<p>Follow this link to reset the password for your user:</p>
-<p><a href="{{ .SiteURL }}/auth/confirm?token_hash={{ .TokenHash }}&type=recovery&next=/path-to-your-update-password-page">Reset Password</a></p>
+<p>
+ <a
+ href="{{ .SiteURL }}/auth/confirm?token_hash={{ .TokenHash }}&type=recovery&next=/path-to-your-update-password-page"
+ >Reset Password</a
+ >
+</p>
```
export const Page = ({ children }) => <Layout meta={meta} children={children} />