OAUTH doesn't work correctly

Set up in /opt/seatable-server/seatable/conf/dtable_web_settings.py

ENABLE_OAUTH = True
OAUTH_ENABLE_INSECURE_TRANSPORT = False 

OAUTH_PROVIDER_DOMAIN = 'link'
OAUTH_PROVIDER = 'authentik'  # логическое имя, можно любое

OAUTH_CLIENT_ID = "seatable"
OAUTH_CLIENT_SECRET = "secret"

OAUTH_REDIRECT_URL = 'link'

OAUTH_AUTHORIZATION_URL = 'link'
OAUTH_TOKEN_URL = 'link'
OAUTH_USER_INFO_URL = 'link'

OAUTH_SCOPE = ["openid", "email", "profile"]

OAUTH_ATTRIBUTE_MAP = {
    "preferred_username": "uid",
    "name": "name",
    "email": "contact_email"
}

But I get an error "Error, please contact administrator: contact_email must be unique and might already be in use."

With the help of GPT I tried to make steps according to the instructions, but nothing works. in SeaFile everything worked from the first time, and here are some problems, please help to solve

everything is linked correctly in the database, but it doesn’t work - it constantly says that a user with such an email already exists or that adding new users is not allowed (there is a reserve of 1 user)

MariaDB [dtable_db]> SELECT * FROM social_auth_usersocialauth WHERE username = '###########@auth.local';
+----+---------------------------------------------+-----------+------------------------------------------------------------------+------------+
| id | username                                    | provider  | uid                                                              | extra_data |
+----+---------------------------------------------+-----------+------------------------------------------------------------------+------------+
| 11 | ###########@auth.local | authentik | ########### | {}         |
+----+---------------------------------------------+-----------+------------------------------------------------------------------+------------+
1 row in set (0.001 sec)

social_auth_usersocialauth is only one the the tables relevant for user authentication. You find more on the topic at Overview - SeaTable Admin Manual.

Please check the other two relevant tables ccnet_db.EmailUser and dtable_db.profile_profile.

I assume that you find the contact_email in question linked to a local user or an incompletely generated OAuth user.

Issue solved?