apps/docs/content/guides/auth/social-login/auth-notion.mdx
To enable Notion Auth for your project, you need to set up a Notion Application and add the Application OAuth credentials to your Supabase Dashboard.
Setting up Notion logins for your application consists of 3 parts:
Go to developers.notion.com.
Click "View my integrations" and login.
Once logged in, go to notion.so/my-integrations and create a new integration.
When creating your integration, ensure that you select "Public integration" under "Integration type" and "Read user information including email addresses" under "Capabilities".
You will need to add a redirect URI, see Add the redirect URI
Once you've filled in the necessary fields, click "Submit" to finish creating the integration.
<$Partial path="social_provider_setup.mdx" variables={{ "provider": "Notion" }} />
<$Partial path="social_provider_settings_supabase.mdx" variables={{ "provider": "Notion" }} />
<Tabs scrollable size="small" type="underlined" defaultActiveId="js" queryGroup="language"
<TabPanel id="js" label="JavaScript">
<$Partial path="create_client_snippet.mdx" />
When your user signs in, call signInWithOAuth() with notion as the provider:
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('<your-project-url>', '<sb_publishable_... or anon key>')
// ---cut---
async function signInWithNotion() {
const { data, error } = await supabase.auth.signInWithOAuth({
provider: 'notion',
})
}
When your user signs in, call signInWithOAuth() with notion as the provider:
Future<void> signInWithNotion() async {
await supabase.auth.signInWithOAuth(
OAuthProvider.notion,
redirectTo: kIsWeb ? null : 'my.scheme://my-host', // Optionally set the redirect link to bring back the user via deeplink.
authScreenLaunchMode:
kIsWeb ? LaunchMode.platformDefault : LaunchMode.externalApplication, // Launch the auth screen in a new webview on mobile.
);
}
When your user signs in, call signInWith(Provider) with Notion as the Provider:
suspend fun signInWithNotion() {
supabase.auth.signInWith(Notion)
}
<$Partial path="oauth_pkce_flow.mdx" />
<Tabs scrollable size="small" type="underlined" defaultActiveId="js" queryGroup="language"
<TabPanel id="js" label="JavaScript">
When your user signs out, call signOut() to remove them from the browser session and any objects from localStorage:
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('<your-project-url>', '<sb_publishable_... or anon key>')
// ---cut---
async function signOut() {
const { error } = await supabase.auth.signOut()
}
When your user signs out, call signOut() to remove them from the browser session and any objects from localStorage:
Future<void> signOut() async {
await supabase.auth.signOut();
}
When your user signs out, call signOut() to remove them from the browser session and any objects from localStorage:
suspend fun signOut() {
supabase.auth.signOut()
}