Casbin Forum runs on Casnode, the open-source Discourse-style forum. Try the Casnode demo →
Casbin Forum

Found that strange too, also didn't see it in Swagger; but this is straight from the Casdoor sdk.js:

        const params = new URLSearchParams(window.location.search);
        const code = params.get("code");
        const state = params.get("state");
        const expectedState = this.getOrSaveState();
        this.clearState();
        if (state !== expectedState) {
            return new Promise((resolve, reject) => {
                setTimeout(() => {
                    resolve({
                        // @ts-ignore
                        status: "error",
                        msg: `invalid state parameter, expected: ${expectedState}, got: ${state}`,
                    });
                }, 10);
            });
        }
        return fetch(`${serverUrl}${signinPath  this.config.signinPath  '/api/signin'}?code=${code}&state=${state}`, {
            method: "POST",
            credentials: "include",
        }).then(res => res.json());
    }

I now think that the '/api/signin' here might be an artifact of an older version of Casdoor?

Correct. My application calls this at the application callback URL, yet it gives me back a 403 Forbidden. Oddly, even if I don't call api/signin. I can still request an access_token.

Some time ago I considered using Google SMTP, but I remember that you needed to have Workspace account with them to do so.. FWIW

Signin methods do not contain OAuth2... I think it's always enabled. With the sign-in methods you can allow or disallow "standard password", "Verification Code", "WebAuthn" (see docs) and "LDAP".

image.png

You probably want to add some OAuth providers, like Google, Facebook, etc.

yeah, thought so.. not possible to export existing config?

I mean... it's free and open source... I am more than happy to be able to give back... But first, I need to get this whole show on the road first..

...speaking of which.. I had configured some stuff, like an organization and some providers.. is there a way to export that and import that into an empty production enviroment, or is that what the syncers are for?

.. or do I use the init_data.json file to get existing config into a new environment?

...again, the least I could do in return

yeah, had seen the page

it's the least I could do... oh, and I could help out with a dutch translation, if you'd need it

would be, if I was on X... not using any social media at all

I'll first implement it, and if all works out, I'd happily write a blog post about it

which is important if you're running on a miniscule OpenVZ, as I am now 😛

yeahh... it's one of the more expensive options, esp. if you're just a hobby project. Their first paid tier is $35/mo, which is a bit on the high side compared to others..

I looked at Authelia and Authentik before deciding to try Casdoor; The Vue integration made me try Casdoor first

Also considered Keycloak, but it fealt a bit bloated...

Must say, Casdoor is now running idle, and it only takes about 20MB of RAM and virtually no CPU

Bit of a learning curve, since I had no prior knowledge, but eventually it worked fairly well, and once logged in, the user stays logged in for a long time, so it's not that bad.

Yeah, they have three different SDK's even that you can choose from (which was kinda confusing).. Since they are a SaaS, integration was a bit finicky, you keep hopping between their and your domain. I hope to prevent that with Casdoor, having it all hosted on my own servers

but basically, I implemented the old-fashioned implicit flow (at that time I didn't know of the improved PKCE-flow)

Their STS issues an access key via JWT, which I pass on to my backend via my SPA

.... in a nutshell 😉

But I also needed some enrollment features (basically getting a freshly generated user_id added to the users profile, which turned out was a paid feature). All-in-all, I decided it was time to take matters in my own hand.

lol, will see what I can do... let's first actually make it happen. I'm at the point that I have a working Casdoor instance in production, but have not touched my Vue code yet...

fwiw... got it running with Postgresql + docker-compose.yml:

version: "3"
services:
  casdoor:
    image: casbin/casdoor
    ports:
      - "8000:8000"
    environment:
      RUNNING_IN_DOCKER: "true"
    depends_on:
      - db
    volumes:
      - ./conf:/conf/
  db:
    image: postgres:14-bookworm
    restart: always
    environment:
      POSTGRES_DB: casdoor
      POSTGRES_USER: MYUSER
      POSTGRES_PASSWORD: ***
    ports:
      - "5433:5432"
    volumes: 
      - db:/var/lib/postgresql/data
volumes:
  db:
    driver: local``` (why not add something like this to the docs?)

cool, that works 👍 still need to get it working via docker-compose; do I understand correctly that the docker-compose.yml in the Github repo is NOT a good starting point, I guess it's for developers of Casdoor? I'm happy to start from scratch, but if there's already a working starting point, that's always easier.

just trying to get an empty bog standard Docker instance of Casdoor running, that shouldn't be too hard right? Just the defaults..

aha got it.. Still, it seems to expect a MySQL database somewhere, given the error message:

panic: dial tcp 127.0.0.1:3306: connect: connection refused```

The app.conf

appname = casdoor
httpport = 8000
runmode = dev
copyrequestbody = true
driverName = sqlite
dataSourceName = "file:casdoor.db?cache=shared"
dbName = casdoor
tableNamePrefix =
showSql = false
redisEndpoint =
defaultStorageProvider =
isCloudIntranet = false
authState = "casdoor"
socks5Proxy = "127.0.0.1:10808"
verificationCodeTimeout = 10
initScore = 0
logPostOnly = true
origin =
originFrontend =
staticBaseUrl = "https://cdn.casbin.org"
isDemoMode = false
batchSize = 100
enableGzip = true
ldapServerPort = 389
radiusServerPort = 1812
radiusSecret = "secret"
quota = {"organization": -1, "user": -1, "application": -1, "provider": -1}
logConfig = {"filename": "logs/casdoor.log", "maxdays":99999, "perm":"0770"}
initDataFile = "./init_data.json"
frontendBaseDir = "../casdoor"

Thanks. But, was already following those instructions.. 😉

I am trying the Docker-Compose build, but having some issues with the instructions. (I am on Windows, with the latest Docker Desktop, using Git Shell).

The mentioned command (docker pull casbin/casdoor:$(curl -sS "https://hub.docker.com/v2/repositories/casbin/casdoor/tags/?page_size=1&page=2" | sed 's/,/,\n/g' | grep '"name"' |awk -F '"' '{print $4}')) does download the latest image and adds it to docker, but nothing else. I was expecting a docker-compose.yml starter/example file somewhere, but perhaps I should create it myself? I did find the conf/app.conf file (and set it up to use SQLite for now). I also did find a docker-compose.yml file in the Github repo, but it seems to depend on other files, I probably can get it to work, but I feel like I'm missing a step somewhere..?

Ok thanks! That's good news, cuz this really looks like it's going to be my replacement for Auth0 🙂