HomeCommunity & Content › Step‑by‑Step Setup of OAuth2 Login with Google for a Discourse Forum

Step‑by‑Step Setup of OAuth2 Login with Google for a Discourse Forum

Updated 2026-07-15 · Hosting Reviews

Hosting Reviews is reader-supported. This page contains affiliate links to Hostinger; we may earn a commission if you sign up through them — at no extra cost to you.

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.

Deal alert
Get Forum & Community Site online
Build an online community or forum — the hosting that handles traffic plus the software to run discussions and groups.
Build Your Community on Hostinger →

Step‑by‑Step Setup of OAuth2 Login with Google for a Discourse Forum

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. Test the Login Flow
    • Visit your forum’s /login page.
    • 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.
  6. 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:

Maintaining Performance and Security

Keep your forum healthy by:

Cost Overview

Typical monthly spend for a growing community:

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.

Ready to buy?
Get Forum & Community Site online
Build an online community or forum — the hosting that handles traffic plus the software to run discussions and groups.
Build Your Community on Hostinger →