mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-13 21:01:21 +08:00
Some checks failed
all-good: Did all the other checks pass? / all-good (push) Has been cancelled
Ensure Prisma migrations are in sync with the schema / check_prisma_migrations (22.x) (push) Has been cancelled
DB migration compat / Check if migrations changed (push) Has been cancelled
Docker Server Build and Push / Docker Build and Push Server (push) Has been cancelled
Docker Server Build and Run / docker (push) Has been cancelled
Runs E2E API Tests (Local Emulator) / E2E Tests (Local Emulator, Node ${{ matrix.node-version }}) (22.x) (push) Has been cancelled
Runs E2E API Tests / E2E Tests (Node ${{ matrix.node-version }}, Freestyle ${{ matrix.freestyle-mode }}) (mock, 22.x) (push) Has been cancelled
Runs E2E API Tests / E2E Tests (Node ${{ matrix.node-version }}, Freestyle ${{ matrix.freestyle-mode }}) (prod, 22.x) (push) Has been cancelled
Runs E2E API Tests with custom port prefix / build (22.x) (push) Has been cancelled
Lint & build / lint_and_build (latest) (push) Has been cancelled
Dev Environment Test With Custom Base Port / restart-dev-and-test-with-custom-base-port (push) Has been cancelled
Dev Environment Test / restart-dev-and-test (push) Has been cancelled
Run setup tests with custom base port / setup-tests-with-custom-base-port (push) Has been cancelled
Run setup tests / setup-tests (push) Has been cancelled
TOC Generator / TOC Generator (push) Has been cancelled
DB migration compat / Back-compat — Current branch migrations with ${{ needs.check-migrations-changed.outputs.base_branch }} branch code (push) Has been cancelled
DB migration compat / Forward-compat — Current branch code with ${{ needs.check-migrations-changed.outputs.base_branch }} branch migrations (push) Has been cancelled
DB migration compat / No migration changes (skipped) (push) Has been cancelled
72 lines
3.1 KiB
Plaintext
72 lines
3.1 KiB
Plaintext
---
|
|
title: "GitHub"
|
|
description: "Set up GitHub as an authentication provider with Stack Auth"
|
|
---
|
|
|
|
This guide explains how to set up GitHub as an authentication provider with Stack Auth. GitHub allows users to sign in to your Stack Auth-enabled app using their GitHub account.
|
|
|
|
<Info>
|
|
For Development purposes, Stack Auth uses shared keys for this provider. Shared keys are automatically created by Stack, but show Stack's logo on the OAuth sign-in page.
|
|
You should replace these before you go into production.
|
|
</Info>
|
|
|
|
## Integration Steps
|
|
|
|
<Info>
|
|
If you are unsure if you need to create a GitHub App, or a GitHub OAuth App, check the [Differences On GitHub](https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/differences-between-github-apps-and-oauth-apps).
|
|
More than likely, you will want to create a GitHub App. The installation process is the same for both.
|
|
</Info>
|
|
|
|
<Steps>
|
|
<Step>
|
|
### Create a GitHub App
|
|
|
|
1. Navigate to your [GitHub Developer App Settings](https://github.com/settings/apps).
|
|
2. Click the **New GitHub App** button.
|
|
3. Enter a name for your application, homepage URL, and a description.
|
|
4. For **Authorization callback URL**, add `https://api.stack-auth.com/api/v1/auth/oauth/callback/github`
|
|
5. For permissions, at a **minimum**, you will need **Account Permissions > Email Addresses** set to **Read Only**. Your sign-in flow will not work without this permission.
|
|
6. Select **Any Account** under the ***Where can this GitHub App be installed*** section.
|
|
7. Click **Create GitHub App**
|
|
8. Save the **Client ID** and click **Generate a new client secret** to create your **Client Secret**.
|
|
</Step>
|
|
|
|
<Step>
|
|
### Enable GitHub Provider in Stack Auth
|
|
|
|
1. On the Stack Auth dashboard, select **Auth Methods** in the left sidebar.
|
|
2. Click **Add SSO Providers** and select **GitHub** as the provider.
|
|
3. Set the **Client ID** and **Client Secret** you obtained from your GitHub App earlier.
|
|
</Step>
|
|
</Steps>
|
|
|
|
***
|
|
|
|
<Accordion title="GitHub OAuth App installation">
|
|
<Steps>
|
|
<Step>
|
|
### Create an OAuth App
|
|
|
|
1. Navigate to your [GitHub Developer Settings](https://github.com/settings/developers).
|
|
2. Click the **New OAuth App** button.
|
|
3. Enter a name for your application, homepage URL, and a description.
|
|
4. For **Authorization callback URL**, add `https://api.stack-auth.com/api/v1/auth/oauth/callback/github`
|
|
5. Click **Register application**
|
|
6. Save the **Client ID** and click **Generate a new client secret** to create your **Client Secret**.
|
|
</Step>
|
|
|
|
<Step>
|
|
### Enable GitHub OAuth in Stack Auth
|
|
|
|
1. On the Stack Auth dashboard, select **Auth Methods** in the left sidebar.
|
|
2. Click **Add SSO Providers** and select **GitHub** as the provider.
|
|
3. Set the **Client ID** and **Client Secret** you obtained from GitHub earlier.
|
|
</Step>
|
|
</Steps>
|
|
</Accordion>
|
|
|
|
### Need More Help?
|
|
|
|
* Check the [GitHub OAuth Documentation](https://docs.github.com/en/developers/apps/building-oauth-apps/authorizing-oauth-apps)
|
|
* Join our [Discord](https://discord.stack-auth.com)
|