Skip to main content

Casdoor

An open-source SSO and identity platform from the Casbin team. Casdoor provides OAuth 2.0, OIDC, SAML, social login (including WeChat, DingTalk, and Alipay), LDAP federation, and multi-organization support — with a clean web UI and SDKs for Node.js, Go, Python, Java, and React.

✓ OIDC + OAuth 2.0 + SAML ✓ 30+ social login providers ✓ Casbin authorization integration ✓ Open source (Apache 2.0)

What is Casdoor?

Casdoor is an authentication server (who are you?) designed as the companion to Casbin (what can you do?). Together, they provide a complete AuthN + AuthZ solution. Casdoor handles user registration, social login, SSO, and token issuance. Casbin enforces access policies using the JWT claims from Casdoor tokens in your application backend.

Casdoor is notable for its extensive social login support — particularly Chinese platforms like WeChat, QQ, DingTalk, Alipay, and Weibo — and for its straightforward Docker deployment. It aims to be easier to operate than Keycloak while covering most enterprise SSO requirements.

Quick Start (Docker)

# Casdoor — Docker with SQLite (dev)
docker run -d   --name casdoor   -p 8000:8000   casbin/casdoor:latest

# Production with PostgreSQL
docker run -d   --name casdoor   -p 8000:8000   -e driverName=postgres   -e dataSourceName="host=postgres user=casdoor password=casdoor dbname=casdoor sslmode=disable"   casbin/casdoor:latest

# Admin UI: http://localhost:8000
# Default credentials: admin / 123

Node.js SDK

// Node.js SDK — Casdoor OIDC integration
import { SDK } from 'casdoor-nodejs-sdk';

const config = {
  endpoint: 'https://auth.example.com',
  clientId: 'your-client-id',
  clientSecret: 'your-client-secret',
  certificate: '-----BEGIN CERTIFICATE-----
...Casdoor public cert...',
  orgName: 'my-organization',
  appName: 'my-app',
};

const sdk = new SDK(config);

// Get OAuth login URL
const loginUrl = sdk.getAuthorizationUrl();

// Exchange code for token (after OAuth callback)
const tokenResponse = await sdk.getOAuthToken(code);
const userInfo = await sdk.parseJwtToken(tokenResponse.access_token);

// Get all users (admin API)
const users = await sdk.getUsers();

React Integration

// React — Casdoor login with SDK
import Casdoor from 'casdoor-js-sdk';

const casdoor = new Casdoor({
  serverUrl: 'https://auth.example.com',
  clientId: 'your-client-id',
  appName: 'my-app',
  organizationName: 'my-org',
  redirectPath: '/callback',
  signinPath: '/api/signin',
});

function LoginButton() {
  return (
    
  );
}

// Callback page
function CallbackPage() {
  const { code, state } = useSearchParams();
  useEffect(() => {
    casdoor.signin(code, state).then(token => {
      localStorage.setItem('token', token.access_token);
      navigate('/dashboard');
    });
  }, []);
}
Share this tool: X / Twitter LinkedIn
✓ 60,000+ developers use DevPlaybook ★★★★★ 4.8 / 5 on Gumroad ✓ MIT licensed · Instant download ✓ No login required

Related Products

on Gumroad

You Might Also Need

More Free Tools

Enjoying this tool? Get more like it.

Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.

DevPlaybook Pro 7 days free

Unlock AI-Powered Dev Tools

  • ⚡ AI Code Review, Doc Generator & SQL Builder
  • ⚡ All premium templates & early access
  • ⚡ Member discounts on Gumroad products
Start Free Trial →

$9/mo after trial · Cancel anytime

Want the full toolkit?

Get DevPlaybook Pro

Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.

$79
$241 separately Save $162 (67% off)
Get DevPlaybook Pro — $79 →

MIT licensed · Instant download · No subscription

See what's included → Browse all deals →