Skip to content

Duplicate key on OpenID connect #4576

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

Closed
klauserber opened this issue Oct 17, 2022 · 3 comments · Fixed by #4614
Closed

Duplicate key on OpenID connect #4576

klauserber opened this issue Oct 17, 2022 · 3 comments · Fixed by #4614
Assignees
Labels
s0 Major regression, all-hands-on-deck to fix
Milestone

Comments

@klauserber
Copy link

klauserber commented Oct 17, 2022

Hello, I am working on a cluster setup for devops & developer trainings. A central part of it is coder to give the participants a fancy development environment. For email based self registration I use keycloak and OIDC in coder. I don't now the email domains, so it is not possible to restrict them.

When 2 users with the same name before the @ try to register (e. g. hans@example1.com and hans@example2.com), the second user gets the error:

{"message":"Failed to process OAuth login.","detail":"in tx: execute transaction: create user: execute transaction: create user: pq: duplicate key value violates unique constraint \"idx_users_username\""}

Is it possible to configure how the names a built? May by converting hans@example2.com to hans-example2-com or similar. Or give the second user a number suffix (hans2).

@bpmct bpmct added the s0 Major regression, all-hands-on-deck to fix label Oct 17, 2022
@bpmct bpmct added this to the EE milestone Oct 17, 2022
@kylecarbs kylecarbs changed the title Dublicate key on OpenID connect Duplicate key on OpenID connect Oct 17, 2022
@bpmct
Copy link
Member

bpmct commented Oct 18, 2022

@klauserber it looks like this just missed the Coder v10.0.1 release but we'll get it in for v10.0.2 later this week

@klauserber
Copy link
Author

@bpmct That is absolutely fine for me. Thank you for the very fast implementation.

How does the solution look like? As I can see in the code, the user get a random name if there is a conflict, right?

@sreya
Copy link
Collaborator

sreya commented Oct 19, 2022

@klauserber using your example above it would be hans-<random-name>. It will only be truly random if the username is longer than 32 characters.

@matifali matifali added the bug label Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s0 Major regression, all-hands-on-deck to fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants