Skip to main content

GitHub

GitHub OAuth supports both the web application flow and device flow. Please continue reading to obtain OAuth credentials.

First, please visit the GitHub developer settings to register a new GitHub App.

caution

Tricks: We recommend that you use GitHub Apps to replace OAuth Apps because GitHub Apps can add multiple redirect URIs, which can bring convenience when deploying test and production environments. The GitHub official also recommends using GitHub Apps instead of OAuth Apps.

githubapps

Then fill in the GitHub App name, Homepage URL, description, and Callback URL.

GitHub

Set the authorization callback URL correctly

In the GitHub App config, the Callback URL must be your Casdoor's callback URL, and the Redirect URL in Casdoor should be your application's callback URL.

For more details, please read App config.

After registering your GitHub App, you can now generate your Client Secret!

GitHub Client ID

Add a GitHub OAuth provider and fill in the Client ID and Client Secret in your Casdoor.

Github Provider

Now you can use GitHub as a third-party service to complete authentication.