🔐 How I Enabled Google & Microsoft OAuth2 Login in Moodle (Step-by-Step Guide)

Posted by Prateek Sharma – July 2025


Many institutions want secure, single-click login for their Moodle platform using Google or Microsoft accounts. In this guide, I’ll share how I configured OAuth2 login (SSO) for both Google and Microsoft — tested on Moodle 4.x running on Linux.

Step 1: Enable OAuth2 Service in Moodle

  1. Login as Admin → Site Administration
  2. Go to Server → OAuth 2 Services
  3. Click Google or Microsoft to configure

Step 2: Create Credentials (Google Console or Azure)

For Google:

For Microsoft:

Step 3: Add Client ID and Secret in Moodle

Once credentials are ready:

  1. Go back to Moodle → OAuth2 Services
  2. Edit the provider → Paste Client ID and Client Secret
  3. Save and verify connection (token should be valid)

Step 4: Enable as Login Option

Go to:

Step 5: Test It

Visit your login page. You should now see buttons for:

Optional Tips


Conclusion

OAuth2 login improves user experience and reduces forgotten password issues. I’ve used it successfully on both Oracle Cloud and in-house Linux servers for IIT-based Moodle platforms.

Need help setting this up? Contact me here or visit MoodleSupport.in for full deployment services.