Skip to main content
Version 0.3Draft

Moodle

Protocol: OIDC Native feature: Moodle OAuth 2 Services (admin/oauth2) Estimated time: 15-20 minutes Reference docs: Moodle Docs - OAuth 2 services (opens in a new tab) (steps verified against Moodle 4.4)

Prerequisites

  • Moodle 3.3 or later with site administrator access
  • Application registered with LuxID with redirect URI: https://your-moodle.com/admin/oauth2callback.php
  • Client ID and Client Secret from your LuxID registration

Step 1 - open OAuth 2 services

In Moodle site administration, go to Site administration > Server > OAuth 2 services.

Click Create new service and select Custom (or OpenID Connect if your Moodle version offers it directly).

Step 2 - field mapping

Service configuration

Moodle fieldValue to enter
NameLuxID
Client IDYour Client ID from your LuxID registration
Client secretYour Client Secret from your LuxID registration
Service base URLhttps://login.luxid.lu
Logo URL(optional - paste your LuxID logo URL or leave blank)
This service will be usedLogin page only (or as required)
Require email verificationUnticked (LuxID verifies email at registration)
Scopesopenid profile email

After saving, click Configure endpoints for the new service.

Endpoint configuration

Endpoint nameURL
discovery_endpointhttps://login.luxid.lu/.well-known/openid-configuration
authorization_endpointhttps://login.luxid.lu/mga/sps/oauth/oauth20/authorize
token_endpointhttps://login.luxid.lu/mga/sps/oauth/oauth20/token
userinfo_endpointhttps://login.luxid.lu/mga/sps/oauth/oauth20/userinfo
jwks_endpointhttps://login.luxid.lu/mga/sps/oauth/oauth20/jwks/OIDC-LUXID

User field mapping

Go to Configure user field mappings for the service:

Moodle fieldExternal field (LuxID claim)
First namegiven_name
Last namefamily_name
Emailemail
Usernameemail

Step 3 - enable OAuth on login page

Go to Site administration > Plugins > Authentication > Manage authentication.

Enable OAuth 2 in the authentication methods list.

Step 4 - test login

  1. Temporarily change the service base URL and endpoints to use login-uat.luxid.lu
  2. Log out of Moodle and go to the login page
  3. A "LuxID" button should appear (or a generic OAuth provider button)
  4. Click it and authenticate with your sandbox LuxID Account
  5. Verify the Moodle user profile is populated with correct first name, last name, and email

Step 5 - production checklist and common errors

Production checklist

  • Restore all endpoint URLs to login.luxid.lu
  • Confirm redirect URI with LuxID matches https://your-moodle.com/admin/oauth2callback.php exactly
  • Test with a real LuxID Account
  • Confirm Moodle username linking policy (match by email or by sub) matches your user management approach
  • If Moodle has existing local accounts, decide whether to enable account linking

Common errors

ErrorCauseFix
OAuth button not on login pageOAuth 2 authentication not enabledEnable in Manage authentication
redirect_uri_mismatchCallback URL not whitelistedAsk LuxID to whitelist https://your-moodle.com/admin/oauth2callback.php
User created with wrong emailemail claim not in Claim TemplateContact LuxID team to add email to the Claim Template
Duplicate account createdMoodle not matching by emailCheck Manage authentication > OAuth 2 > account matching settings
Endpoints not savedMoodle caches endpoint discoveryClear Moodle's cache after changing endpoint URLs
Updated 2026-06-02