The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
docs: add web3 docs (#35650)
Stojan Dimitrovski654484408a7a
diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.tsindex fc3e6ae2806..0dcb96f727b 100644--- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts+++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts@@ -631,6 +631,7 @@ export const auth = {],},{ name: 'Anonymous Sign-Ins', url: '/guides/auth/auth-anonymous' },+ { name: 'Web3 (Sign in with Solana)', url: '/guides/auth/auth-web3' },{ name: 'Mobile Deep Linking', url: '/guides/auth/native-mobile-deep-linking' },{name: 'Identity Linking',diff --git a/apps/docs/content/guides/auth/auth-anonymous.mdx b/apps/docs/content/guides/auth/auth-anonymous.mdxindex b46189ad5de..7c363423ab3 100644--- a/apps/docs/content/guides/auth/auth-anonymous.mdx+++ b/apps/docs/content/guides/auth/auth-anonymous.mdx@@ -4,7 +4,7 @@ title: 'Anonymous Sign-Ins'subtitle: 'Create and use anonymous users to authenticate with Supabase'----[Enable Anonymous Sign-Ins](/dashboard/project/_/settings/auth) to build apps which provide users an authenticated experience without requiring users to enter an email address, password, use an OAuth provider or provide any other PII (Personally Identifiable Information). Later, when ready, the user can link an authentication method to their account.+[Enable Anonymous Sign-Ins](/dashboard/project/_/auth/providers) to build apps which provide users an authenticated experience without requiring users to enter an email address, password, use an OAuth provider or provide any other PII (Personally Identifiable Information). Later, when ready, the user can link an authentication method to their account.<Admonition type="note" label="Anonymous user vs the anon key">diff --git a/apps/docs/content/guides/auth/auth-web3.mdx b/apps/docs/content/guides/auth/auth-web3.mdxnew file mode 100644index 00000000000..4cdd718943b--- /dev/null+++ b/apps/docs/content/guides/auth/auth-web3.mdx@@ -0,0 +1,156 @@+---+id: 'auth-web3'+title: 'Sign in with Web3'+subtitle: 'Use your Web3 wallet to authenticate users with Supabase'+---++[Enable Sign In with Web3](/dashboard/project/_/auth/providers) to allow users to sign in to your application using only their Web3 wallet.++Supported Web3 wallets:++- All Solana wallets+- Coming soon: All Ethereum wallets++## How does it work?++Sign in with Web3 utilizes the [EIP 4361](https://eips.ethereum.org/EIPS/eip-4361) standard to authenticate wallet addresses off-chain. This standard is adopted by the Solana ecosystem with some minor differences from Ethereum.++Authentication works by asking the Web3 wallet application to sign a predefined message with the user's wallet. This message is parsed both by the Web3 wallet application and Supabase Auth to verify its validity and purpose, before creating a user account or session.++The Web3 wallet application uses the information contained in the message to provide the user with a confirmation dialog, asking whether they want to allow sign in with your project.++Not all Web3 wallet applications show a dedicated confirmation dialog for these sign in messages. In that case the Web3 wallet shows a traditional message signature confirmation dialog.++### Potential for abuse++User accounts that sign in with their Web3 wallet will not have an email address or phone number associated with them. This can open your project to abuse as creating a Web3 wallet account is free and easy to automate and difficult to correlate with a real person's identity.++Control your project's exposure by configuring:++- [Rate Limits for Web3](/dashboard/project/_/auth/rate-limits)+- [Enable CAPTCHA protection](/docs/guides/auth/auth-captcha)++Many wallet applications will warn the user if the message sent for signing is not coming from the page they are currently visiting. To further prevent your Supabase project from receiving signed messages destined for other applications, you must register your application's URL using the [Redirect URL settings](/docs/guides/auth/redirect-urls).++For example if the user is signing in to the page `https://example.com/sign-in` you should add the following configurations in the Redirect URL settings:++- `https://example.com/sign-in/` (last slash is important)+- Alternatively set up a glob pattern such ash `https://example.com/**`++## Sign in with Ethereum++Sign in with Ethereum wallets is coming soon.++## Sign in with Solana++<Tabs+ scrollable+ size="small"+ type="underlined"+ defaultActiveId="window"+ queryGroup="solanaWallet"+>++<TabPanel id="window" label="Solana Window API">++Most Solana wallet applications expose their API via the `window.solana` global scope object in your web application.++Supabase's JavaScript Client Library provides built-in support for this API.++To sign in a user make sure that:++1. The user has installed a wallet application (by checking that the `window.solana` object is defined)+2. The wallet application is connected to your application by using the [`window.solana.connect()` API](https://docs.phantom.com/solana/establishing-a-connection)++Use the following code to authenticate a user:++```typescript+const { data, error } = await supabase.auth.signInWithWeb3({+ chain: 'solana',+ statement: 'I accept the Terms of Service at https://example.com/tos',+})+```++Providing a `statement` is required for most Solana wallets and this message will be shown to the user on the consent dialog. It will also be added to the identity data for your users.++If you are using a non-standard Solana wallet that does not register the `window.solana` object, or your user has multiple Solana wallets attached to the page you can disambiguate by providing the wallet object like so:++- To use [Brave Wallet with Solana](https://wallet-docs.brave.com/solana):+ ```typescript+ const { data, error } = await supabase.auth.signInWithWeb3({+ chain: 'solana',+ statement: 'I accept the Terms of Service at https://example.com/tos',+ wallet: window.braveSolana,+ })+ ```+- To use [Phantom with Solana](https://docs.phantom.com/solana/detecting-the-provider):+ ```typescript+ const { data, error } = await supabase.auth.signInWithWeb3({+ chain: 'solana',+ statement: 'I accept the Terms of Service at https://example.com/tos',+ wallet: window.phantom,+ })+ ```++</TabPanel>++<TabPanel id="adapter" label="Solana Wallet Adapter">++Although the `window.solana` global scope JavaScript API is an unofficial standard, there still are subtle differences between wallet applications. The Solana ecosystem has provided the [Solana Wallet Adapter](https://solana.com/developers/courses/intro-to-solana/interact-with-wallets#solanas-wallet-adapter) system based on the [Wallet Standard](https://github.com/wallet-standard/wallet-standard) to simplify ease of development.++The Supabase JavaScript Client Library supports signing in with this approach too. Follow the [Solana Interact with Wallets](https://solana.com/developers/courses/intro-to-solana/interact-with-wallets) guide on how to install and configure your application.++Below is a short example on using a `<SignInButton />` component that uses the `useWallet()` React hook to obtain the connected wallet and sign the user in with it:++```tsx+function SignInButton() {+ const wallet = useWallet()++ return (+ <>+ {wallet.connected ? (+ <button+ onClick={() => {+ supabase.auth.signInWithWeb3({+ chain: 'solana',+ statement: 'I accept the Terms of Service at https://example.com/tos',+ wallet,+ })+ }}+ >+ Sign in with Solana+ </button>+ ) : (+ <WalletMultiButton />+ )}+ </>+ )+}++function App() {+ const endpoint = clusterApiUrl('devnet')+ const wallets = useMemo(() => [], [])++ return (+ <ConnectionProvider endpoint={endpoint}>+ <WalletProvider wallets={wallets}>+ <WalletModalProvider>+ <SignInButton />+ </WalletModalProvider>+ </WalletProvider>+ </ConnectionProvider>+ )+}+```++</TabPanel>++</Tabs>++## Frequently asked questions++### How to associate an email address, phone number or social login to a user signing in with Web3?++Web3 wallets don't expose any identifying information about the user other than their wallet address (public key). This is why accounts that were created using Sign in with Web3 don't have any email address or phone number associated.++To associate an email address, phone number or other social login with their account you can use the `supabase.auth.updateUser()` or `supabase.auth.linkIdentity()` APIs.diff --git a/apps/docs/content/guides/auth/redirect-urls.mdx b/apps/docs/content/guides/auth/redirect-urls.mdxindex db273676726..c61e3572f59 100644--- a/apps/docs/content/guides/auth/redirect-urls.mdx+++ b/apps/docs/content/guides/auth/redirect-urls.mdx@@ -7,8 +7,12 @@ subtitle: 'Set up redirect urls with Supabase Auth.'## Overview+Supabase Auth allows your application to receive a [user session](/docs/guides/auth/sessions) on web pages or in mobile apps that only you allow.+When using [passwordless sign-ins](/docs/reference/javascript/auth-signinwithotp) or [third-party providers](/docs/reference/javascript/auth-signinwithoauth#sign-in-using-a-third-party-provider-with-redirect), the Supabase client library methods provide a `redirectTo` parameter to specify where to redirect the user to after authentication. By default, the user will be redirected to the [`SITE_URL`](/docs/guides/auth/redirect-urls) but you can modify the `SITE_URL` or add additional redirect URLs to the allow list. Once you've added necessary URLs to the allow list, you can specify the URL you want the user to be redirected to in the `redirectTo` parameter.+When using [Sign in with Web3](/docs/guides/auth/auth-web3) the message signed by the user in the Web3 wallet application will indicate the URL on which the signature took place. Supabase Auth will reject messages that are signed for URLs that have not been allowed.+To edit the allow list, go to the [URL Configuration](/dashboard/project/_/auth/url-configuration) page. In local development or self-hosted projects, use the [configuration file](/docs/guides/cli/config#auth.additional_redirect_urls).## Use wildcards in redirect URLsdiff --git a/supa-mdx-lint/Rule001HeadingCase.toml b/supa-mdx-lint/Rule001HeadingCase.tomlindex 307503e449b..872b473a5b6 100644--- a/supa-mdx-lint/Rule001HeadingCase.toml+++ b/supa-mdx-lint/Rule001HeadingCase.toml@@ -62,6 +62,7 @@ may_uppercase = ["Enterprise Plan","Events","Expo",+ "Ethereum","Facebook","Facebook Developers?","Fair Use Policy",@@ -187,6 +188,7 @@ may_uppercase = ["SvelteKit","Swift","SwiftUI",+ "Solana","Team Plan","Telegram","Third-Party Auth",@@ -218,6 +220,7 @@ may_uppercase = ["WebP","WebSockets?","WebStorm",+ "Web3","Windows","WorkOS","Wrappers",diff --git a/supa-mdx-lint/Rule003Spelling.toml b/supa-mdx-lint/Rule003Spelling.tomlindex 450a724fe8c..e15c9961fa9 100644--- a/supa-mdx-lint/Rule003Spelling.toml+++ b/supa-mdx-lint/Rule003Spelling.toml@@ -143,6 +143,7 @@ allow_list = ["Entra","ePHI","Erlang",+ "Ethereum","Figma","Firestore","Fivetran",@@ -241,6 +242,7 @@ allow_list = ["SendGrid","Session Timebox","Snaplet",+ "Solana","SolidJS","Spotify","Sqitch",