If you want to enable “Login with GitHub” for your Discourse forum, here’s the simplest working flow that actually does the job ![]()
Step 1: Create a GitHub OAuth App
Go to GitHub Developer Settings:
- Create a New OAuth App
- Set:
- Homepage URL:
https://your-domain.com - Authorization callback URL:
https://your-domain.com/auth/github/callback
- Homepage URL:
- Copy the Client ID and Client Secret
Step 2: Enable GitHub login in Discourse
In Discourse Admin → Settings → Login :
- Enable GitHub logins
- Paste:
- GitHub Client ID
- GitHub Client Secret
- Save changes
Step 3: Force HTTPS (important)
Edit your Discourse container config:
vim /var/discourse/containers/app.yml
Under the env: section, add:
DISCOURSE_FORCE_HTTPS: true
This is required if your site is behind HTTPS (Cloudflare, Nginx, etc.), otherwise GitHub OAuth may fail or redirect incorrectly.
Step 4: Rebuild Discourse
Apply the changes:
cd /var/discourse
./launcher rebuild app
Done
After the rebuild:
- You should see “Log in with GitHub” on the login page
- OAuth redirect works correctly over HTTPS
- No more invalid_credentials or redirect issues
Tip:
If you’re using Cloudflare / reverse proxy, make sure:
- GitHub callback URL uses https
Hope this saves someone a few hours of debugging ![]()