you're facing this error because django receives nique usernames. so you
are not allowed to create another username with the same username.

On Wed, Oct 6, 2021 at 1:36 AM Ammon Quackenbush <aq...@chem.byu.edu> wrote:

>
> I am setting up keycloak for a django project and this is the error I
> receive:
>
>
> IntegrityError at /oidccallback/UNIQUE constraint failed:
> auth_user.usernameRequest Method:
> GET
>
> It looks like when I log in, keycloak tries to create my user again, even
> though my user is in the database.
>
> Also, my usernames are hashed in the auth_user table in the database.
>
> This is my code in my settings.py:
>
> DATABASES = {
>     'default': {
>         'ENGINE': 'django.db.backends.sqlite3',
>         'NAME': BASE_DIR / 'db.sqlite3',
>     }
> }
>
> I also tried setting the OIDC_CREATE_USER setting to False but that only
> prevented django from from detecting login sessions (which still were
> created properly).
>
> Any ideas on what is going wrong and how I can fix it?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6be23087-ab54-4bfb-8a57-1bc8fbe35359n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/6be23087-ab54-4bfb-8a57-1bc8fbe35359n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKPY9pmEdZCt%2BG0JH-Yy8t6YOEVZBnikWritg0xxuPxj4Bbhkg%40mail.gmail.com.

Reply via email to