Skip to main content


Casdoor can be used to connect Moodle using OAuth.

The following are some configuration settings:

  • CASDOOR_HOSTNAME: The domain name or IP where the Casdoor server is deployed.
  • Moodle_HOSTNAME: The domain name or IP where Moodle is deployed.

Step 1: Deploy Casdoor and Moodle

First, deploy Casdoor and Moodle.

After successful deployment, ensure the following:

  1. Casdoor can be logged in and used without issues.
  2. You can set CASDOOR_HOSTNAME as http://localhost:8000 when deploying Casdoor in prod mode. See production mode.

Step 2: Configure Casdoor Application

  1. Create a new Casdoor application or use an existing one.
  2. Find the redirect URL: Moddle_HOSTNAME/admin/oauth2callback.php.
  3. Add the redirect URL to the Casdoor application.

For more information on OAuth, refer to OAuth.

Step 3: Configure Moodle

  1. Locate OAuth Find_OAuth.
  2. Configure this application configure.
  3. Configure this mapping Mapping.
  4. Locate the OAuth2 plugin plugin.
  5. Enable the OAuth2 plugin Enable.
  6. If you want to prevent the editing of Casdoor's email Fields.

For more information on Moodle, refer to Moodle and Fields mapping.

Log out of Moodle and test SSO. Login