Custom OAuth providers

Admin Guide

Custom OAuth providers

Add any OIDC-compliant custom sign-in method

Besides the built-in OAuth providers, Root can add any OIDC-compliant custom sign-in method. Sign in with the Root account, open the system settings page (`/console/setting`) and find the "Custom OAuth" section. The web console follows the reference design and is still being wired up; for now, the demo data is linked to the sign-in page through localStorage.

Add a custom OAuth provider

easyapi.com/console/setting#custom-oauth

Custom OAuth providers

Configure custom OAuth providers. Any identity provider compatible with OAuth 2.0 / OpenID Connect is supported, such as GitHub Enterprise, GitLab, Gitea, NextCloud, Keycloak and Casdoor. Callback URL format: {Site URL}/oauth/{slug}

+ Add OAuth provider
IconNameSlugStatusClient IDActions
No custom OAuth providers yet

Preview of the "Custom OAuth" section at the bottom of System settings: info banner, add button and empty list

Open the settings section

After signing in as Root, open /console/setting and scroll to the "Custom OAuth providers" card at the bottom of the page. Like the other tabs in System settings, it is part of the option / custom_oauth_provider configuration.

Add a provider

Click "+ Add OAuth provider" to open the form and fill in the name, Slug, Client ID/Secret and OAuth endpoints. Avoid changing the Slug after creation; otherwise you must update the callback URL on the IdP side as well.

Callback URL format

In the IdP app settings, set the Redirect URI to:

{Site URL}/oauth/{slug}

Here, "Site URL" is ServerAddress from System settings (e.g. https://ai.example.com), and {slug} matches the Slug field in the form.

Provider list

ColumnFieldDescription
IconiconProvider logo URL or icon identifier
NamenameLabel shown on the sign-in button, e.g. "Company GitLab"
SlugslugUnique identifier used in the callback path `/oauth/{slug}`
StatusenabledWhen enabled, the provider appears in the third-party section of the sign-in and sign-up pages
Client IDclient_idClient ID issued after registering the app with the IdP (can be masked in the list)
Actions—Edit, enable/disable, delete

Configure Client ID / Secret

  1. Create an OAuth / OIDC app in your IdP (GitLab, Keycloak, etc.) and note the Client ID and Client Secret.
  2. Set the callback URL to `{ServerAddress}/oauth/{slug}`; the slug must exactly match the Slug entered in EasyAPI.
  3. In EasyAPI, go to System settings → Custom OAuth → "Add OAuth provider" and fill in the endpoints and scopes; providing well_known simplifies endpoint setup.
  4. Save and enable it (enabled=1). Only enabled providers appear in the third-party section at the bottom of `/login` and `/register`.

Form fields

SettingFieldDescription
NamenameRequired; shown on the sign-in button
SlugslugRequired; lowercase letters, globally unique; determines the callback URL path
IconiconOptional; icon URL
Client IDclient_idClient ID of the OAuth app
Client Secretclient_secretSecret of the OAuth app; not shown in plain text in the list after saving
Authorization endpointauthorization_endpointOAuth authorize URL
Token endpointtoken_endpointOAuth token URL
User info endpointuser_info_endpointAPI that returns the user profile
ScopesscopesDefaults to openid profile email; adjust as your IdP requires
Well-Knownwell_knownOptional; OIDC `.well-known/openid-configuration` URL for automatic endpoint discovery
User ID fielduser_id_fieldKey used to read the unique ID from the userinfo JSON; defaults to sub
Username fieldusername_fieldMapped to the system username; defaults to preferred_username
Display name fielddisplay_name_fieldMapped to nickname; defaults to name
Email fieldemail_fieldMapped to email; defaults to email
Auth styleauth_style0 = send client_secret as a parameter; 1 = send it in a header (required by some IdPs)
Access policyaccess_policyOptional JSON that limits which users may sign in
Denial messageaccess_denied_messageMessage shown to users when the policy denies access

The fields of the custom_oauth_provider table map one-to-one to the form above; the slug column has a unique index.

Endpoints and scopes

  • Standard OIDC: fill in well_known to resolve the authorization / token / userinfo endpoints automatically
  • Plain OAuth 2.0: fill in authorization_endpoint, token_endpoint and user_info_endpoint manually
  • Example scopes: openid profile email (OIDC) or read:user user:email (GitHub)
  • Built-in OAuth routes such as GET /api/oauth/github and wechat coexist with custom /oauth/{slug} routes without conflict

Test the OAuth callback

  1. Sign out, open `/login` and check that the new OAuth button appears at the bottom.
  2. Clicking the button should take you to the IdP authorization page; after authorizing, you are redirected to `{Site URL}/oauth/{slug}` and signed in or your account is linked.
  3. Under "Profile settings → Account linking", verify that the third-party account is linked.
  4. If it fails, check that the Client Secret, callback URL, scopes and userinfo field mappings match the JSON returned by the IdP.

For the user-side OAuth sign-in flow, see the "Third-party OAuth sign-in" section of the Sign up and sign in docs.

Related

  • For an overview of system settings, see System settings
  • For account linking, see Profile settings (/setting)
  • Only providers with enabled=1 appear on the sign-in page; disabling a provider does not affect users who already linked it