GitHub OAuth error

GitHub OAuth callback URL mismatch.

GitHub OAuth apps have a Homepage URL and an Authorization callback URL. A production callback failure usually means the callback field, app registration, or environment URL is wrong.

Failure stage

GitHub authorize URL sent: the app started OAuth with a client ID.
Failed first: GitHub callback URL comparison or wrong OAuth app registration.
Not reached yet: access token request and GitHub API permissions.

GitHub evidence matrix

EvidenceLikely causeFirst check
Callback URL field contains site homepageHomepage/callback confusionPut the exact callback route in Authorization callback URL.
Production app sends localhost callbackDev callback left in configSwitch environment variables to production callback.
Multiple GitHub OAuth apps existWrong client ID in productionEdit the app whose client ID appears in the request.
Callback path changed after deploymentFramework route mismatchCompare app route config with GitHub callback field.
www differs from non-wwwCanonical host mismatchUse one production host in app and GitHub settings.

Bad GitHub setup

Homepage URL:
https://example.com

Authorization callback URL:
http://localhost:3000/auth/github/callback

Production app sends:
https://example.com/auth/github/callback

Corrected pattern

Homepage URL:
https://example.com

Authorization callback URL:
https://example.com/auth/github/callback

Pattern to verify in your environment.

What this is not

  • It is not a GitHub token permission issue until GitHub accepts the callback and returns a code.
  • It is not fixed by changing repository permissions on the OAuth app.
  • It is not the Homepage URL field unless that field was copied into the callback field.
  • It is not solved by regenerating the client secret first.