Django app for gitea oauth2.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
czar 20050becb5 Add "README.md" 7 months ago
README.md Add "README.md" 7 months ago
__init__.py Initial commit 8 months ago
admin.py Initial commit 8 months ago
apps.py Initial commit 8 months ago
backends.py Simplify configuration 7 months ago
models.py Simplify configuration 7 months ago
tests.py Initial commit 8 months ago
utils.py Initial commit 8 months ago
views.py Initial commit 8 months ago

README.md

Gitea Auth App for Django Social Auth

Adding to a project:

settings.py


GITEA_INSTANCE_URL = "https://gt.kalli.st"

INSTALLED_APPS = [
	...
	"social_django",
	"gitea_auth",
]

AUTHENTICATION_BACKENDS = ["gitea_auth.backends.OAuth2"]

SOCIAL_AUTH_PIPELINE = [
    'social_core.pipeline.social_auth.social_details',
    'social_core.pipeline.social_auth.social_uid',
    'social_core.pipeline.social_auth.social_user',
    'social_core.pipeline.user.get_username',
    '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',
]

SOCIAL_AUTH_URL_NAMESPACE = 'auth'

CLIENT_KEY_AND_SECRET = {
	"kalli.st" : ("key", "secret" )
}

LOGIN_REDIRECT_URL = '/admin/'

urls.py

from django.urls import path, include

urlpatterns = [
	...
	path("auth/", include("social_django.urls", namespace="auth"), name="auth"),
]