Skip to content

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

added Github login

Mark Burggraf0fcbde57532a
diff --git a/web/docs/guides/auth/auth-github.mdx b/web/docs/guides/auth/auth-github.mdx
new file mode 100644
index 00000000000..092e18d12e5
--- /dev/null
+++ b/web/docs/guides/auth/auth-github.mdx
@@ -0,0 +1,108 @@
+---
+id: auth-github
+title: "Github Login"
+description: Setting up Github Login
+---
+
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+
+### Setting up Github Login
+
+## Description
+
+Adding a Github Login button to your application is easy if you follow these steps.
+
+The setup process consists of three parts:
+
+* Create and configure a Github OAuth App on [Github](https://github.com)
+* Add your Github OAuth keys to your [Supabase Project](https://supabase.io)
+* Add the login code to your [Supabase JS Client App](https://github.com/supabase/supabase-js)
+
+## Environment
+
+* [Supabase JS Client](https://github.com/supabase/supabase-js)
+* [Supabase Dashboard (UI)](https://supabase.io)
+* [Github Developer Settings](https://github.com/settings/developers)
+
+## Requirements
+* Supabase account (Free Tier OK)
+* Any existing Supabase Project
+* Javascript-based client application (Angular, React, Vue, etc.)
+
+## Steps
+
+### Log into your [Github](https://github.com) Account
+
+Once logged into *"Github"*:
+
+- Click on your profile photo at the top right
+- Click Settings near the bottom of the menu
+- In the left sidebar, click "Developer settings" (near the bottom)
+- In the left sidebar, click "OAuth Apps"
+- Click "Register a new application"
+ - (If you've created an app before, click "New OAuth App" here)
+- In "Application name", type the name of your app.
+- In "Homepage URL", type the full URL to your app's website.
+- In "Authorization callback URL", type the callback URL of your app.
+ - Your OAuth Redirect URI looks like this:
+ - https://xxxxxxxxxxxxxxxx.supabase.co/auth/v1/callback
+ - where https://xxxxxxxxxxxxxxxx.supabase.co is your Supabase Project API URL
+ - Go to your [Supasebase Project Dashboard](https://supabase.io)
+ - Click on the "Settings" icon at the bottom of the left sidebar
+ - Click on "API" in the list
+ - Under Config / URL you'll find your API URL, you can click "Copy" to copy it to the clipboard
+ - Now just add "/auth/v1/callback" to the end of that to get your full "OAauth Redirect URI"
+ - Enter this in the "Valid OAuth Redirect URIs" box
+ - Click "Save Changes" at the bottom right
+- Click "Register Application"
+
+Copy your new OAuth credentials
+
+- Copy and save your "Client ID"
+- Click "Generate a new client secret"
+- Copy and save your "Client secret"
+
+### Enter your Github Client ID and Client Secret into your Supabase Project
+
+- Go to your [Supasebase Project Dashboard](https://supabase.io)
+- In the left sidebar, click the "Authentication" icon (near the top)
+- Click "Settings" from the list to go to the "Authentication Settings" page
+- Enter the final (hosted) URL of your app under "Site URL" (this is important)
+- Under "External OAuth Providers" turn "Github Enabled" to ON
+- Enter your "Github Client ID" and "Github Client Secret" saved in the previous step
+- Click "Save"
+
+### Add login code to your client app
+
+The JavaScript client code is documented here: [Supabase OAauth Client Code](https://supabase.io/docs/reference/javascript/auth-signin#sign-in-using-third-party-providers)
+
+```js
+const { user, session, error } = await supabase.auth.signIn({
+ provider: 'github'
+})
+```
+
+Just put this code in a function and create a button or a link or any other UI element to call the function.
+
+```js
+function signInWithGithub() {
+ const { user, session, error } = await supabase.auth.signIn({
+ provider: 'github'
+ });
+}
+```
+
+To log out:
+
+```js
+function signout() {
+ const { error } = await supabase.auth.signOut();
+}
+```
+
+## Resources
+
+* [Supabase Account - Free Tier OK](https://supabase.io)
+* [Supabase JS Client](https://github.com/supabase/supabase-js)
+* [Github Developer Settings](https://github.com/settings/developers)
diff --git a/web/sidebars.js b/web/sidebars.js
index 55e414f06e2..ea67e1b6108 100755
--- a/web/sidebars.js
+++ b/web/sidebars.js
@@ -122,7 +122,7 @@ module.exports = {
type: 'category',
label: 'Auth',
collapsed: false,
- items: ['guides/auth/auth-facebook', 'guides/auth/auth-google'],
+ items: ['guides/auth/auth-facebook', 'guides/auth/auth-google', 'guides/auth/auth-github'],
},
{
type: 'category',