Skip to content
The Auth.js project is now part of Better Auth.

providers/casdoor

Built-in sign in with Casdoor integration.

CasdoorProfile

The returned user profile from Casdoor when using the profile callback. Casdoor follows the OpenID Connect standard claims and may return custom fields.

Extends

Indexable

[key: string]: any

Properties

email?

optional email: string;

email_verified?

optional email_verified: boolean;

name?

optional name: string;

phone?

optional phone: string;

picture?

optional picture: string;

preferred_username?

optional preferred_username: string;

sub

sub: string;

default()

function default(options): OIDCConfig<CasdoorProfile>

Setup

Callback URL

https://example.com/api/auth/callback/casdoor

Configuration

import Casdoor from "@auth/core/providers/casdoor"
...
providers: [
  Casdoor({
    clientId: env.AUTH_CASDOOR_ID,
    clientSecret: env.AUTH_CASDOOR_SECRET,
    issuer: env.AUTH_CASDOOR_ISSUER ?? "https://door.casdoor.com", // Your Casdoor instance
  }),
]
...

Resources

Notes

  • Casdoor instances are self-hosted or cloud-hosted. Set the issuer to the base URL of the instance you manage (for example https://door.casdoor.com).
  • Casdoor exposes the standard .well-known/openid-configuration metadata, so no additional endpoints need to be configured.
  • Make sure the Redirect URI registered in Casdoor exactly matches the callback URL shown above.
  • The Casdoor provider comes with a default configuration. To override the defaults, see customizing a built-in OAuth provider.

Help

If you think you found a bug in the default configuration, you can open an issue.

Auth.js strictly adheres to the specification and it cannot take responsibility for any deviation from the spec by the provider. You can open an issue, but if the problem is non-compliance with the spec, we might not pursue a resolution. You can ask for more help in Discussions.

Parameters

ParameterType
optionsOIDCUserConfig<CasdoorProfile>

Returns

OIDCConfig<CasdoorProfile>

Auth.js © Better Auth Inc. - 2025