Getting a duplicate error after authenticating via Okta #14253
Replies: 2 comments 1 reply
-
After authenticating via Okta/Auth0, the following appears in the social_auth_usersocialauth table: $ sudo -u postgres psql -d netbox -c 'select * from social_auth_usersocialauth' Subsequent authentications via Okta will try to produce another table entry with provider "okta-openidconnect" and uid "None" which is not allowed because of the constraint that the provider/uid combo should be unique. Still not sure how to change Okta to populate the uid. Also looking into how to change the constraint to using the provider and user_id (not uid) instead. If anyone has any suggestions, please let me know. Thanks. |
Beta Was this translation helpful? Give feedback.
-
So I switched to using Okta (instead of Auth0) and this is no longer an issue. When I login, the social_auth_usersocialauth table gets populated with provider "okta-openidconnect" and an actual value for uid rather than just "None." Also, when I logout and log back in, the entry in the social_auth_usersocialauth table gets updated. So no more errors regarding "duplicate key." |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello. I'm running Netbox v3.1.7 on Ubuntu 20.04. I've configured authentication via Okta OIDC. The first login works fine but any subsequent logins (even using a different username) results in error:
My configuration.py is as follows:
REMOTE_AUTH_ENABLED = True
REMOTE_AUTH_BACKEND = 'social_core.backends.okta_openidconnect.OktaOpenIdConnect'
SOCIAL_AUTH_OKTA_OPENIDCONNECT_KEY= 'xxxxxxx'
SOCIAL_AUTH_OKTA_OPENIDCONNECT_SECRET= 'xxxxxx'
SOCIAL_AUTH_OKTA_OPENIDCONNECT_API_URL= 'https://dev-xyt2ijb2tbk2pnrt.us.auth0.com/'
SOCIAL_AUTH_PIPELINE = [
"social_core.pipeline.social_auth.social_details",
"social_core.pipeline.social_auth.social_uid",
"social_core.pipeline.social_auth.auth_allowed",
"social_core.pipeline.social_auth.social_user",
"social_core.pipeline.social_auth.associate_by_email",
"social_core.pipeline.user.create_user",
"social_core.pipeline.social_auth.associate_user",
"social_core.pipeline.social_auth.load_extra_data",
"social_core.pipeline.user.user_details"
]
REMOTE_AUTH_HEADER = 'HTTP_REMOTE_USER'
REMOTE_AUTH_AUTO_CREATE_USER = True
REMOTE_AUTH_DEFAULT_GROUPS = []
REMOTE_AUTH_DEFAULT_PERMISSIONS = {}
Any ideas as to why this is happening? Any help would be greatly appreciated.

Beta Was this translation helpful? Give feedback.
All reactions