Accepts a CasdoorConfig or plain options.
Adds a user (org/name, name or e-mail) to roles, creating missing roles.
Browser authorize URL on publicUrl (code flow, PKCE S256).
Releases connections. Idempotent.
Creates or aligns the OAuth application; returns its client credentials.
Creates or aligns an SMTP e-mail provider and lists it on the configured application.
Creates the organization unless it exists (password rules, TOTP offered).
Creates every missing role.
Creates or aligns a user (verified e-mail by default) and assigns its roles.
Exchanges the authorization code from the browser redirect for tokens.
Mails a password reset code. Throws NotFoundError for unknown e-mails (do not reveal it).
Unauthenticated liveness: GET /api/health. Never throws for an unhealthy service.
Authenticated round trip with the admin credentials (admin session or client credentials): reads the application. Returns the latency in milliseconds.
New tokens from a refresh token.
Sets a new password with the code from forgotPassword.
Mails a verification code (Casdoor allows one code per address per 60 s → RateLimitError).
Server version (/api/get-version-info, needs the admin session).
Starts TOTP enrollment for the user of the access token.
Headless password sign-in (code flow + PKCE inside the BFF). Throws MfaRequiredError when
the user has TOTP and no totpCode/recoveryCode was given, EmailNotVerifiedError when the
e-mail is not verified and requireVerifiedEmail is on.
Ends the Casdoor session of the token (access or id token). Idempotent.
Registers a user (/api/signup). Pass emailCode when the application requires it.
Checks the code and marks the user's e-mail verified (needs the client credentials).
Verifies the first TOTP code and enables TOTP for the user.
StaticfromBuilds a client from the environment: GROW_CASDOOR_*, then the platform names
GROW_AUTH_ISSUER|PUBLIC_URL, GROW_AUTH_CLIENT_ID/SECRET, GROW_AUTH_ORG/APP,
GROW_AUTH_REDIRECT_URL, CASDOOR_ADMIN_PASSWORD.
Client for Casdoor: user flows for backends-for-frontends and idempotent admin operations.
Every Casdoor
{"status":"error"}answer (HTTP 200) and every OAuth error becomes a typed CasdoorError subclass with acasdoorReason.