auth.api.hasPermission
I am having an issue with the hasPermission that it is not being recognized and is not a function of auth.api. I confirmed my version and checked the auth-client and auth setup. Any ideas?
10 Replies
Could not reproduce on the latest release
Can you share your auth setup?
I assume you want to use
organization plugin, so you need to pass it to the plugins array:
Here is my client and auth setup
you're type asserting the returnType of better-auth which overwrites the types. I assume you're doing this because you were running into ts issues before, so I would double check to make sure you disabled
declaration, declarationMap, & composite in your tsconfig (and make strict: true)That fixed it. I am fairly new to TS what are those compiler options? I am building a monorepo and I am using turbo and those were set when I started a new project.
@Better Auth What is the schema for the dyamica access control?
Also why can i not use
authClient.organization.createRole to create a role it states its a 404 when trying to do dynamic access controlDoes it provide anything in the logs?
Not all it gives is the 404 error POST /api/auth/organization/create-role 404 in 2692ms
You shouldn't be getting 404 if you've enabled it, do other org endpoints work?
It was a weird error. I figured it out I just redid both my auth.ts and auth-client.ts