-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed create rule constraint: Only admins can create new accounts with OAuth2 #291
Comments
By default it does not allow automatic registration. The users have to be created ahead of time either by REST API or manually adding them through PocketBase. I will add an env var in the future to allow automatic registration via OAuth2. If you need to do this now, toggle off this switch on Then edit the In "API Rules" change the "Create rule" to Then go back to |
Thanks a lot. Will there be a way to auto provision roles based on oidc claims? |
I'll look into it. For now every new registration should get the Note that PocketBase admin accounts are separate from Beszel user accounts, so if you want someone to be able to log into PocketBase, you need to create an admin account for them at |
Yes I did that, thanks, just wanted to know if it was planned. Pocketbase does not support oidc enrollment for admin sadly but it's fine. Thanks for your time 😁. |
Would it be possible to create some form of a docs/wiki page? I think this is a good first page. I kindly ask for additional information on how the user identifier is mapped or whether it is configurable. thanks |
@MarkusGnigler I'm working on a docs site for the next release here: https://preview.beszel.dev The OAuth functionality is native to PocketBase, so I don't know every detail on how it's implemented. But the accounts should be linked with a unique ID originating from the OAuth account (see screenshot). Are you having an issue with this? I agree that user groups would be a nice time-saving feature if you have many users or systems. It's something I'd like to add in the future. For now, perhaps using the REST API would be the most efficient way to assign users to systems. Here's an example using the PocketBase JS SDK with Bun: import PocketBase from 'pocketbase'
const pb = new PocketBase('http://localhost:8090')
const systemNames = ['localhost', 'kagemusha']
const userEmails = ['[email protected]', '[email protected]']
// authenticate as admin
await pb.admins.authWithPassword(process.env.EMAIL, process.env.PASSWORD)
// get user ids
const userIds = await pb
.collection('users')
.getFullList({
fields: 'id',
filter: `email='${userEmails.join(`'||email='`)}'`,
})
.then((records) => records.map(({ id }) => id))
// get id and current users for systems
const systemsData = await pb.collection('systems').getFullList({
fields: 'id,users',
filter: `name='${systemNames.join(`'||name='`)}'`,
})
// loop through systems and add users to them
for (const system of systemsData) {
const updatedUsers = Array.from(new Set([...system.users, ...userIds]))
await pb.collection('systems').update(system.id, { users: updatedUsers })
} |
Sorry for being late, had a complete server crash this weekend, Thanks for pointing me to the documentation page. Thanks for the snippet, and also for your friendly, open-minded personality for accepting all kinds of ideas! |
Hello,
I setup OIDC with Authentik.
When I try to login with OIDC for the first time (did not try with already existing user)
I get the following log.
The text was updated successfully, but these errors were encountered: