Django app for gitea oauth2.
Go to file
Czar 20050becb5 Add "README.md" 2021-03-17 09:18:26 -03:00
README.md Add "README.md" 2021-03-17 09:18:26 -03:00
__init__.py Initial commit 2021-03-07 09:41:33 -03:00
admin.py Initial commit 2021-03-07 09:41:33 -03:00
apps.py Initial commit 2021-03-07 09:41:33 -03:00
backends.py Simplify configuration 2021-03-17 09:16:28 -03:00
models.py Simplify configuration 2021-03-17 09:16:28 -03:00
tests.py Initial commit 2021-03-07 09:41:33 -03:00
utils.py Initial commit 2021-03-07 09:41:33 -03:00
views.py Initial commit 2021-03-07 09:41:33 -03:00

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"),
]