I was able to solve this problem by removing commas from the end of lines 
from my models in models.py.

On Wednesday, October 6, 2021 at 2:59:33 AM UTC-6 [email protected] wrote:

> Hi, can you make a snapshot of your models.py file?
>
> On Wednesday, October 6, 2021 at 7:26:24 AM UTC+2 [email protected] 
> wrote:
>
>> 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 <[email protected]> 
>> 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 [email protected].
>>> 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c24c8fd0-b0dd-4665-8208-62085a90c934n%40googlegroups.com.

Reply via email to