GitHub OAuth setup for Authverse projects
This page details how to add and configure GitHub OAuth for Authverse projects.
Execute the following command to add the GitHub provider to your project:
npx authverse@latest add githubIn your GitHub Settings (Developer settings → OAuth Apps → [Your App]), configure the Authorization callback URL:
http://localhost:3000/api/auth/callback/githubhttps://example.com/api/auth/callback/github[!NOTE] If you modify your auth base path (default:
/api/auth), ensure these redirect URIs are updated to match.
Add the following variables to your project's .env file:
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=Replace the values with the Client ID and Client Secret from your GitHub OAuth App.
[!TIP] Adjust this configuration to use your preferred method for securely storing secrets in CI/CD pipelines.
Import the prebuilt provider component and integrate it into your UI:
import GithubProviders from "@/components/authverse/GithubProviders";
<GithubProviders />;This component renders the GitHub sign-in option at its location.
https://example.com with your authenticated domain.