fix oauth
All checks were successful
Docker / build (release) Successful in 9s

This commit is contained in:
krek0 2026-05-17 06:36:48 +02:00
parent 1de1cb4086
commit 997fd760d2
11 changed files with 99 additions and 37 deletions

View file

@ -4,6 +4,7 @@
import requests
from allauth.socialaccount import app_settings
from django.core.exceptions import ImproperlyConfigured
from allauth.socialaccount.providers.oauth2.views import (
OAuth2Adapter,
OAuth2CallbackView,
@ -31,20 +32,27 @@ class OAuthAdapter(OAuth2Adapter):
@property
def domain(self):
return self.settings.get("DOMAIN", "")
domain = self.settings.get("DOMAIN", "")
if not domain:
raise ImproperlyConfigured(
"OAUTH_SERVER_URL is not configured. Set it in your .env file."
)
return domain
@property
def access_token_url(self):
return f"https://{self.domain}/o/token/"
return self.settings.get("TOKEN_URL", f"https://{self.domain}/application/o/token/")
@property
def authorize_url(self):
return f"https://{self.domain}/o/authorize/"
return self.settings.get("AUTHORIZE_URL", f"https://{self.domain}/application/o/authorize/")
@property
def profile_url(self):
return f"https://{self.domain}/api/me/"
return self.settings.get("PROFILE_URL", f"https://{self.domain}/application/o/userinfo/")
OAuthProvider.oauth2_adapter_class = OAuthAdapter
oauth2_login = OAuth2LoginView.adapter_view(OAuthAdapter)
oauth2_callback = OAuth2CallbackView.adapter_view(OAuthAdapter)