Implementing Single Sign-On (SSO) in Moodle can be a game-changer for your organisation. It simplifies the login experience, strengthens security, and helps users access multiple platforms without juggling multiple passwords. But when SSO doesn’t work as expected, it can cause confusion, login loops, or mismatched accounts that frustrate users and admins alike.

In this post, we’ll look at the most common Moodle SSO issues, why they happen, and how to fix them.

What SSO Is and Why It Matters

SSO allows users to log in once and gain access to multiple systems, like Moodle, Microsoft 365, or Google Workspace, without needing to re-enter their credentials.

For education providers and corporate training platforms, this means fewer password resets, smoother onboarding, and a more seamless digital experience. But to work correctly, all systems must “trust” each other and share user data securely through OAuth2 or SAML protocols.

Common Moodle SSO Issues

1. Endless Login Loops
A user logs in, is redirected to Moodle, and then immediately sent back to the identity provider (IdP) — over and over again. This typically points to a cookie, session, or redirect misconfiguration.

2. Mismatched User Accounts
If the user’s email or username doesn’t exactly match between Moodle and the IdP, Moodle might fail to link the accounts. This often happens when organisations change email domains (e.g. from @company.com to @org.com).

3. Invalid or Expired Tokens
OAuth2-based logins rely on secure access tokens. If these tokens expire too quickly or the server clock is out of sync, users might see “Invalid token” or “Access denied” messages.

Troubleshooting Steps

If your Moodle SSO integration isn’t behaving as expected, here’s a quick checklist to help you get back on track:

1. Review OAuth2 Setup

  • Go to Site administration → Server → OAuth 2 services.
  • Make sure the client ID, secret, and redirect URLs match what’s configured in your identity provider (Azure AD, Google, Okta, etc.).
  • Reconnect the service if tokens have expired.

2. Check Cookie and Session Settings

  • Ensure Moodle’s cookie domain matches your SSO domain (e.g. both under mycompany.com).
  • Confirm cookies are not being blocked by the browser or by strict SameSite policies.

3. Use HTTPS Everywhere
SSO requires secure connections to exchange tokens. If your site isn’t fully HTTPS-enabled, tokens may be rejected by the IdP.

4. Verify Time Synchronisation
Make sure your Moodle server’s clock matches the IdP’s. Even a small time difference can invalidate OAuth2 tokens.

Testing SSO Configurations

Before rolling out SSO to all users, test thoroughly with:

  • Different user roles: admin, teacher, student.
  • Private/incognito browsers: to rule out cached sessions.
  • Debugging tools: enable Moodle debugging under Site administration → Development → Debugging and check your web server logs for redirect or token errors.

You can also use browser tools (like Chrome DevTools) to monitor redirects and confirm successful authentication flows.

Tips for Maintaining Secure SSO Connections

  • Rotate credentials regularly (client secrets, certificates).
  • Monitor token lifespans and refresh intervals.
  • Enable multi-factor authentication (MFA) where possible.
  • Keep Moodle and plugins updated, as OAuth2 and SAML integrations often include important security patches.

SSO can dramatically improve your users’ experience, but it requires careful setup and ongoing maintenance. With proper configuration and periodic testing, you can avoid login loops, mismatched users, and other headaches, ensuring a smooth and secure connection between Moodle and your authentication provider