The GitHub provider configuresDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/nuxt-alt/auth/llms.txt
Use this file to discover all available pages before exploring further.
@nuxt-alt/auth to authenticate users through GitHub OAuth. It uses the oauth2 scheme with a server-side token exchange — because GitHub returns access tokens from a back-end request rather than in a URL fragment, the provider calls addAuthorize to register a Nuxt server route that performs the token exchange on behalf of the browser. This means your clientSecret stays on the server and is never exposed to the client.
Required Options
| Option | Type | Description |
|---|---|---|
clientId | string | The Client ID of your GitHub OAuth App |
clientSecret | string | The Client Secret of your GitHub OAuth App |
Configuration
Auto-Configured Defaults
When the strategy name isgithub, the provider automatically sets the following values. Any property you specify in your own config takes precedence.
| Property | Auto-Configured Value |
|---|---|
scheme | 'oauth2' |
endpoints.authorization | https://github.com/login/oauth/authorize |
endpoints.token | https://github.com/login/oauth/access_token |
endpoints.userInfo | https://api.github.com/user |
scope | ['user', 'email'] |
token.property | 'access_token' |
token.type | 'Bearer' |
token.name | 'Authorization' |
refreshToken.property | 'refresh_token' |
responseType | 'token' |
clientSecretTransport | 'body' |
Logging In
Trigger the GitHub OAuth redirect from any component or composable:In your GitHub OAuth App settings, set the Authorization callback URL to match your application’s callback route. The default used by
@nuxt-alt/auth is /login. Navigate to Settings → Developer settings → OAuth Apps in your GitHub account to configure this.