Skip to content

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

fix malformed mdx

Jon Meyers4bdd4eed2bd0
diff --git a/apps/reference/docs/guides/auth/auth-helpers/remix.mdx b/apps/reference/docs/guides/auth/auth-helpers/remix.mdx
index 713ccd20659..652b73a918d 100644
--- a/apps/reference/docs/guides/auth/auth-helpers/remix.mdx
+++ b/apps/reference/docs/guides/auth/auth-helpers/remix.mdx
@@ -41,6 +41,9 @@ This library supports the following tooling versions:
- Remix: `>=1.7.2`
+</TabItem>
+</Tabs>
+
## Set up environment variables
Retrieve your project URL and anon key in your project's [API settings](https://app.supabase.com/project/_/settings/api) in the Dashboard to set up the following environment variables. For local development you can set them in a `.env` file. See an [example](https://github.com/supabase/auth-helpers/blob/main/examples/remix/.env.example).
@@ -324,7 +327,7 @@ Now we can call `createBrowserClient` in our components to fetch data client-sid
</TabItem>
-<TabItem value="ts>
+<TabItem value="ts">
In order to use the Supabase client in the browser - fetching data in `useEffect` or subscribing to realtime events - we need to do a little more plumbing. Remix does not include a way to make environment variables available to the browser, so we need to pipe them through from a `loader` function in our `root.tsx` route and attach them to the `window`.
@@ -472,6 +475,7 @@ export const action = async ({ request }) => {
);
};
```
+
</TabItem>
<TabItem value="ts">
@@ -550,6 +554,7 @@ export const action = async ({ request }) => {
);
};
```
+
</TabItem>
<TabItem value="ts">
@@ -623,6 +628,7 @@ export const action = async ({ request }) => {
);
};
```
+
</TabItem>
<TabItem value="ts">
@@ -824,62 +830,6 @@ const supabaseClient = createBrowserClient<Database>(
When using third-party auth providers, sessions are initiated with an additional `provider_token` field which is persisted as an HTTPOnly cookie upon logging in to enabled usage on the server side. The `provider_token` can be used to make API requests to the OAuth provider's API endpoints on behalf of the logged-in user. In the following example, we fetch the user's full profile from the third-party API using their id and auth token:
-```js
-import { User, withPageAuth } from '@supabase/auth-helpers-nextjs'
-
-export default function ProtectedPage({
- user,
- allRepos,
-}: {
- user: User,
- allRepos: any,
-}) {
- return (
- <>
- <div>Protected content for {user.email}</div>
- <p>Data fetched with provider token:</p>
- <pre>{JSON.stringify(allRepos, null, 2)}</pre>
- <p>user:</p>
- <pre>{JSON.stringify(user, null, 2)}</pre>
- </>
- )
-}
-
-export const getServerSideProps = withPageAuth({
- redirectTo: '/',
- async getServerSideProps(ctx, supabase) {
- const {
- data: { session },
- error,
- } = await supabase.auth.getSession()
- if (error) {
- throw error
- }
- if (!session) {
- return { props: {} }
- }
-
- // Retrieve provider_token & logged in user's third-party id from metadata
- const { provider_token, user } = session
- const userId = user.user_metadata.user_name
-
- const allRepos = await (
- await fetch(
- `https://api.github.com/search/repositories?q=user:${userId}`,
- {
- method: 'GET',
- headers: {
- Authorization: `token ${provider_token}`,
- },
- }
- )
- ).json()
-
- return { props: { allRepos, user } }
- },
-})
-```
-
```jsx
import { User, createServerClient } from '@supabase/auth-helpers-remix';
import { ActionFunction, json, redirect } from '@remix-run/node'; // change this import to whatever runtime you are using