mirror of
https://github.com/supabase/supabase.git
synced 2026-07-25 08:52:43 -04:00
192a736d7f
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary - **Documentation** - Reworked API settings content to recommend client libraries for auto-generated Data API endpoints, refreshed authentication/URL guidance, and streamlined API keys messaging. - Updated shared setup partials and restructured the database quickstart with clearer dashboard/management API steps and expanded SQL/RLS snippets. - Updated multiple framework quickstarts to use consistent section-based layouts and refreshed environment-variable instructions across guides. - **Chores** - Expanded MDX heading-case lint allowlist for common framework names (Astro, Flask, Node, Rails, TanStack Start). <!-- end of auto-generated comment: release notes by coderabbit.ai --> ## How to test Run the docs site locally: ```bash pnpm install pnpm dev:docs # serves on http://localhost:3001 ``` Then start with the **Next.js quickstart**, which exercises every change in this PR: 👉 http://localhost:3001/docs/guides/getting-started/quickstarts/nextjs Verify on that page: - [ ] **"Get API details"** section now renders **before** the "Declare environment variables" step, and shows the live **Project URL** + **publishable key** helper widgets (moved into the shared `api_settings.mdx` partial). - [ ] The shadcn/ui **"Explore Components"** CTA appears in the **"Query data"** section (not up top in the create-app step). - [ ] The API keys deprecation notice still renders, and there are no broken/empty partial includes. ### Where to find the rest All other framework quickstarts got the same treatment and live in the same folder — just swap the framework slug in the URL: `http://localhost:3001/docs/guides/getting-started/quickstarts/<framework>` `reactjs`, `vue`, `nuxtjs`, `astrojs`, `tanstack`, `solidjs`, `sveltekit`, `expo-react-native`, `flutter`, `kotlin`, `ios-swiftui`, `flask`, `hono`, `refine`, `redwoodjs`, `ruby-on-rails` Things that vary by framework (worth a quick spot-check across a couple): - **UI CTA** kept only on React-DOM frameworks (Next.js, React, TanStack, Astro); removed from non-React / React Native (Vue, Nuxt, SolidJS, SvelteKit, Expo). - **Mobile guides** (Flutter, Kotlin, iOS SwiftUI): the "Get API details" partial renders *after* the client-init code block, so the key helper widgets show below the snippet rather than beside it. - **Redwood, Hono, Refine, Laravel** Are quite different from the other quickstarts, so I didn't touch them as much and they need some further thought. Because the edited `api_settings.mdx` partial is shared, these non-quickstart pages also render it and are worth a glance: - Auth quickstarts: `/docs/guides/auth/quickstarts/{nextjs,react,react-native,astrojs}` - `/docs/guides/auth/server-side/creating-a-client` - `/docs/guides/realtime/getting_started` - Getting-started setup guides that pull in `project_setup.mdx` / `kotlin_project_setup.mdx` --------- Co-authored-by: awaseem <8704380+awaseem@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Miranda Limonczenko <miranda.limonczenko@supabase.io> Co-authored-by: Jeremias Menichelli <jmenichelli@gmail.com>
145 lines
3.6 KiB
Plaintext
145 lines
3.6 KiB
Plaintext
---
|
|
title: 'Use Supabase Auth with React Native'
|
|
subtitle: 'Learn how to use Supabase Auth with React Native'
|
|
breadcrumb: 'Auth Quickstarts'
|
|
hideToc: true
|
|
---
|
|
|
|
<StepHikeCompact>
|
|
|
|
<StepHikeCompact.Step step={1}>
|
|
<StepHikeCompact.Details title="Create a new Supabase project">
|
|
|
|
[Launch a new project](/dashboard) in the Supabase Dashboard.
|
|
|
|
Your new database has a table for storing your users. You can see that this table is currently empty by running some SQL in the [SQL Editor](/dashboard/project/_/sql).
|
|
|
|
</StepHikeCompact.Details>
|
|
|
|
<StepHikeCompact.Code>
|
|
|
|
```sql name=SQL_EDITOR
|
|
select * from auth.users;
|
|
````
|
|
|
|
</StepHikeCompact.Code>
|
|
|
|
</StepHikeCompact.Step>
|
|
|
|
<StepHikeCompact.Step step={2}>
|
|
|
|
<StepHikeCompact.Details title="Create a React app">
|
|
|
|
Create a React app using the `create-expo-app` command.
|
|
|
|
</StepHikeCompact.Details>
|
|
|
|
<StepHikeCompact.Code>
|
|
|
|
```bash name=Terminal
|
|
npx create-expo-app -t expo-template-blank-typescript my-app
|
|
```
|
|
|
|
</StepHikeCompact.Code>
|
|
|
|
</StepHikeCompact.Step>
|
|
|
|
<StepHikeCompact.Step step={3}>
|
|
<StepHikeCompact.Details title="Install the Supabase client library">
|
|
|
|
Install `supabase-js` and the required dependencies.
|
|
|
|
</StepHikeCompact.Details>
|
|
|
|
<StepHikeCompact.Code>
|
|
|
|
```bash name=Terminal
|
|
cd my-app && npx expo install @supabase/supabase-js @react-native-async-storage/async-storage @rneui/themed react-native-url-polyfill
|
|
```
|
|
|
|
</StepHikeCompact.Code>
|
|
|
|
</StepHikeCompact.Step>
|
|
|
|
<StepHikeCompact.Step step={4}>
|
|
<StepHikeCompact.Details title="Set up your login component">
|
|
|
|
Create a helper file `lib/supabase.ts` that exports a Supabase client using your Project URL and key.
|
|
|
|
Rename `.env.example` to `.env` and populate with your Supabase connection variables:
|
|
|
|
<ProjectConfigVariables variable="url" />
|
|
<ProjectConfigVariables variable="publishable" />
|
|
|
|
|
|
</StepHikeCompact.Details>
|
|
<StepHikeCompact.Code>
|
|
|
|
<$CodeSample
|
|
path="/auth/quickstarts/react-native/lib/supabase.ts"
|
|
lines={[[1, -1]]}
|
|
meta="name=lib/supabase.ts"
|
|
/>
|
|
|
|
<$Partial path="api_settings.mdx" variables={{ "framework": "exporeactnative", "tab": "mobiles" }} />
|
|
|
|
</StepHikeCompact.Code>
|
|
|
|
</StepHikeCompact.Step>
|
|
|
|
<StepHikeCompact.Step step={5}>
|
|
<StepHikeCompact.Details title="Create a login component">
|
|
|
|
Create a React Native component to manage logins and sign ups. The app later uses the [`getClaims`](/docs/reference/javascript/auth-getclaims) method in `App.tsx` to validate the local JWT before showing the signed-in user.
|
|
|
|
</StepHikeCompact.Details>
|
|
|
|
<StepHikeCompact.Code>
|
|
|
|
<$CodeSample
|
|
path="/auth/quickstarts/react-native/components/Auth.tsx"
|
|
lines={[[1, -1]]}
|
|
meta="name=components/Auth.tsx"
|
|
/>
|
|
|
|
</StepHikeCompact.Code>
|
|
|
|
</StepHikeCompact.Step>
|
|
|
|
<StepHikeCompact.Step step={6}>
|
|
<StepHikeCompact.Details title="Add the Auth component to your app">
|
|
|
|
Add the `Auth` component to your `App.tsx` file. If the user is logged in, print the user id to the screen.
|
|
|
|
</StepHikeCompact.Details>
|
|
|
|
<StepHikeCompact.Code>
|
|
|
|
<$CodeSample
|
|
path="/auth/quickstarts/react-native/App.tsx"
|
|
lines={[[1, -1]]}
|
|
meta="name=App.tsx"
|
|
/>
|
|
|
|
</StepHikeCompact.Code>
|
|
|
|
</StepHikeCompact.Step>
|
|
|
|
<StepHikeCompact.Step step={7}>
|
|
<StepHikeCompact.Details title="Start the app">
|
|
|
|
Start the app, and follow the instructions in the terminal.
|
|
|
|
</StepHikeCompact.Details>
|
|
|
|
<StepHikeCompact.Code>
|
|
|
|
```bash name=Terminal
|
|
npm start
|
|
```
|
|
|
|
</StepHikeCompact.Code>
|
|
|
|
</StepHikeCompact.Step>
|
|
</StepHikeCompact>
|