Step‑by‑Step Setup of OAuth2 Login with Google for a Discourse Forum
Updated 2026-07-15 · Hosting Reviews
Choosing the Right Hosting for a Discourse Forum
Discourse runs best on a dedicated or VPS environment because it needs a reliable database and enough RAM for active users. Shared hosting is usually too limited; cloud or VPS plans give you the control and scalability you need. For most small to medium communities, a 2‑core, 4‑GB VPS or a cloud instance in the $10–$20/month range is a solid starting point. Hostinger’s VPS plans start at $3/month and offer free SSD storage, which is great for a new forum. They also provide a one‑click Discourse installer that handles all dependencies for you.
Domain, SSL, and Site Speed Basics
Register a short, memorable domain through Hostinger or any registrar. Hostinger includes a free SSL certificate on all plans, so your forum will load over HTTPS automatically. Enable Cloudflare or a similar CDN to serve static assets from edge servers; this reduces latency for users worldwide. Keep the theme lightweight and disable unused plugins—Discourse’s default theme is already optimized for speed.
Step‑by‑Step Setup of OAuth2 Login with Google for a Discourse Forum
- Create a Google Cloud Project
- Navigate to Google Cloud Console.
- Click Create Project, name it (e.g., “My Discourse Forum”), and note the Project ID.
- Enable the Google+ API
- In the console, go to APIs & Services > Library.
- Search for “Google+ API” and enable it. This is required for OAuth2 authentication.
- Set Up OAuth 2.0 Credentials
- Go to Credentials and click Create Credentials > OAuth client ID.
- Choose Web application as the application type.
- Under Authorized JavaScript origins add your forum URL (e.g.,
https://forum.example.com). - Under Authorized redirect URIs add
https://forum.example.com/auth/google_oauth2/callback. - Save and copy the Client ID and Client Secret.
- Configure Discourse
- Log in to your Discourse admin panel.
- Navigate to Admin > Settings > Authentication.
- Enable Google OAuth2 by toggling the switch.
- Paste the Client ID and Client Secret you just copied.
- Set the Scopes to
openid email profile(this is the default). - Save changes.
- Test the Login Flow
- Visit your forum’s
/loginpage. - Click the Google button; you should be redirected to Google’s consent screen.
- After granting permission, you’ll return to your forum as a logged‑in user.
- Visit your forum’s
- Optional: Customize the Button
- Discourse allows you to edit the login page theme or use a plugin to style the Google button to match your brand.
Deploying Discourse on Hostinger
Hostinger’s VPS or cloud plans simplify deployment:
- Choose a plan (e.g., VPS 1 for $3/month).
- Use the One‑Click Installers in the control panel to install Discourse; the wizard will set up Docker, PostgreSQL, and Redis.
- After installation, SSH into the server, run
sudo discourse setupto configure domain, email, and admin credentials. - Once completed, your forum is live and ready for the Google OAuth setup described above.
Maintaining Performance and Security
Keep your forum healthy by:
- Updating Discourse and its dependencies regularly.
- Backing up the database and files monthly.
- Limiting login attempts with a plugin or server rule to protect against brute‑force attacks.
- Using the built‑in SSL and enforcing HTTPS through the admin panel.
Cost Overview
Typical monthly spend for a growing community:
- Domain: $10–$15/year (often free with hosting).
- VPS hosting: $3–$15/month (Hostinger’s entry level is $3).
- Email service: $5–$10/month if you use a dedicated provider.
- Optional CDN: $0–$10/month.
FAQ
How do I know if my forum needs a VPS instead of shared hosting?
Check your traffic and active user count. If you exceed 1,000 concurrent users or need custom server configurations (e.g., specific Docker images), switch to a VPS or cloud instance. Shared hosting typically caps RAM and CPU, causing slowdowns.
Can I use another OAuth provider besides Google?
Yes. Discourse supports Facebook, GitHub, Twitter, and others. The setup process mirrors Google’s: create an app in the provider’s developer console, obtain client credentials, and enter them in Discourse’s authentication settings.
Will Hostinger’s free SSL cover my entire forum, including subdomains?
Hostinger’s free SSL automatically secures the primary domain and all subdomains you add through the control panel. For extra protection, enable HTTPS enforcement in the Discourse admin panel.