Troubleshooting Guide¶
Common questions:¶
Admin Message: State Mismatched. Time expired?
This error occurs when the user is redirected to the Google login page and then returns to the Django login page but original state are not found. Please check if the browser has the anonymous session created by Django.
Admin Message: User not allowed to login
Please check your filters, some combinations can filter all users. Use the option GITHUB_SSO_SHOW_ADDITIONAL_ERROR_MESSAGES
to show additional error messages in django message system when authentication fails.
There's too much information on logs and messages from this app.
You can disable the logs using the GITHUB_SSO_ENABLE_LOGS
setting and the messages using the GITHUB_SSO_ENABLE_MESSAGES
setting.
System goes looping to admin after login.
This is because the user data was received from GitHub, but the user was not created in the database or is not active.
To see these errors please check the logs or enable the option GITHUB_SSO_SHOW_FAILED_LOGIN_MESSAGE
to see failed
login messages on browser. Please, make note these messages can be used on exploit attacks.
Got a "KeyError: 'NAME'" error after set SSO_USE_ALTERNATE_W003
If you get a KeyError: 'NAME'
error, please set a NAME
in TEMPLATES
at settings.py
:
# settings.py
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"NAME" : "default", # <-- Add name here
"DIRS": [BASE_DIR / "templates"],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
"django.template.context_processors.debug",
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
],
},
},
]
Got this error when migrating: 'The model User is already registered with 'core.GitHubSSOUserAdmin'
This is because you're already define a custom User model and admin in your project. You need to extended the
existing user model
unregistering your current User Admin class and add manually the GitHubSSOUserAdmin
in your custom class.
You can use the get_current_user_and_admin
helper as explained here (the recommended action), or
alternately, you can add the django-google-sso
at the end of your INSTALLED_APPS
list.
Example App¶
To test this library please check the Example App
provided here.
Not working?¶
Don't panic. Get a towel and, please, open an issue.