> ## Documentation Index
> Fetch the complete documentation index at: https://archie.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# GitHub OAuth

> Configure GitHub OAuth for authentication.

GitHub OAuth lets users sign in to your Archie app using their GitHub account. Distinct from [Connecting GitHub](/features/github/connecting), which links a project to a repository for code sync.

## Setup

1. Create an OAuth App in your GitHub developer settings:
   * Application name: your app's name
   * Homepage URL: your app's URL
   * Authorization callback URL: provided by Archie when you select GitHub OAuth
2. Copy the **Client ID** and **Client Secret** from GitHub.
3. In Archie, open **Backend → App services → Authentication providers**.
4. Add or edit the OAuth2 provider with GitHub's endpoints:
   * Authorization URL: `https://github.com/login/oauth/authorize`
   * Token URL: `https://github.com/login/oauth/access_token`
   * User info URL: `https://api.github.com/user`
   * Scopes: `read:user user:email`
5. Paste the client ID and secret. Save.

## What you get

After setup, your app's sign-in screen shows a "Sign in with GitHub" option. Users authenticate against GitHub; Archie creates or updates the local user record using their GitHub email.

## Profile mapping

GitHub returns:

* `id` — GitHub user ID (use as a stable identifier)
* `email` — primary email (request `user:email` scope to get this when private)
* `login` — GitHub username
* `avatar_url` — profile picture

Map these to your app's user fields in the auth provider configuration.

## Errors

The Archie app handles two common error pages:

* `/github-oauth-error` — shown when GitHub returns an error or the user cancels
* `/github-setup-complete` — shown after a successful repository link or OAuth setup

## FAQ

<AccordionGroup>
  <Accordion title="Can I require GitHub OAuth for organization members only?">
    Yes — restrict by GitHub organization membership using the `read:org` scope and a check during sign-in.
  </Accordion>

  <Accordion title="Does this affect the project-to-repo connection?">
    No. They are separate features even though both use GitHub.
  </Accordion>

  <Accordion title="Can I support sign-in with both GitHub and Google?">
    Yes. Configure both providers; users can pick at sign-in.
  </Accordion>
</AccordionGroup>
