Social auth for new users is not working #7169

Closed
opened 2025-12-29 20:20:03 +01:00 by adam · 2 comments
Owner

Originally created by @dostalradim on GitHub (Oct 27, 2022).

Originally assigned to: @arthanson on GitHub.

NetBox version

v3.3.6

Python version

3.10

Steps to Reproduce

I tested authentication against Keycloak with social auth. With following configuration.

LOGIN_REQUIRED: "True"
REMOTE_AUTH_BACKEND: "social_core.backends.keycloak.KeycloakOAuth2"
SOCIAL_AUTH_KEYCLOAK_PUBLIC_KEY: "MIIBIjANBgkqhkiG9w0BA..."
SOCIAL_AUTH_KEYCLOAK_KEY: "netbox"
SOCIAL_AUTH_KEYCLOAK_AUTHORIZATION_URL: "https://keycloak.../auth/realms/DEV/protocol/openid-connect/auth"
SOCIAL_AUTH_KEYCLOAK_ACCESS_TOKEN_URL: "https://keycloak.../auth/realms/DEV/protocol/openid-connect/token"
SOCIAL_AUTH_KEYCLOAK_SECRET: "xxx"

Expected Behavior

Successfully authenticated user.

Observed Behavior

The version 3.3.5 is working fine but version 3.3.6 is ending with following error. It is broken only for new users when the user already exists in the local database there is no error and everything is working.

image

netbox log

Internal Server Error: /oauth/complete/keycloak/
Originally created by @dostalradim on GitHub (Oct 27, 2022). Originally assigned to: @arthanson on GitHub. ### NetBox version v3.3.6 ### Python version 3.10 ### Steps to Reproduce I tested authentication against Keycloak with social auth. With following configuration. ``` LOGIN_REQUIRED: "True" REMOTE_AUTH_BACKEND: "social_core.backends.keycloak.KeycloakOAuth2" SOCIAL_AUTH_KEYCLOAK_PUBLIC_KEY: "MIIBIjANBgkqhkiG9w0BA..." SOCIAL_AUTH_KEYCLOAK_KEY: "netbox" SOCIAL_AUTH_KEYCLOAK_AUTHORIZATION_URL: "https://keycloak.../auth/realms/DEV/protocol/openid-connect/auth" SOCIAL_AUTH_KEYCLOAK_ACCESS_TOKEN_URL: "https://keycloak.../auth/realms/DEV/protocol/openid-connect/token" SOCIAL_AUTH_KEYCLOAK_SECRET: "xxx" ``` ### Expected Behavior Successfully authenticated user. ### Observed Behavior The version 3.3.5 is working fine but version 3.3.6 is ending with following error. It is broken only for new users when the user already exists in the local database there is no error and everything is working. <img width="618" alt="image" src="https://user-images.githubusercontent.com/9046924/198276417-bbb9026f-0500-47c6-9bd9-9e1527513ca6.png"> netbox log ``` Internal Server Error: /oauth/complete/keycloak/ ```
adam added the type: bugstatus: accepted labels 2025-12-29 20:20:03 +01:00
adam closed this issue 2025-12-29 20:20:03 +01:00
Author
Owner

@mochipon commented on GitHub (Oct 31, 2022):

This issue is critical for me and 100% reproducible.

As per the contributing guide, I need to wait for the issue to be accepted and assigned to someone, but here is a tiny patch to fix the issue 2c0d1887fa

@mochipon commented on GitHub (Oct 31, 2022): This issue is critical for me and 100% reproducible. As per the [contributing guide](https://github.com/netbox-community/netbox/blob/master/CONTRIBUTING.md), I need to wait for the issue to be accepted and assigned to someone, but here is a tiny patch to fix the issue https://github.com/netbox-community/netbox/commit/2c0d1887fa8bb60f837ac43460457ee3ba07dac1
Author
Owner

@kkthxbye-code commented on GitHub (Oct 31, 2022):

@arthanson - Could you have a look at this. Caused by: https://github.com/netbox-community/netbox/pull/10549

@kkthxbye-code commented on GitHub (Oct 31, 2022): @arthanson - Could you have a look at this. Caused by: https://github.com/netbox-community/netbox/pull/10549
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7169