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

This commit is contained in:
krek0 2026-05-16 19:51:50 +02:00
parent 1de1cb4086
commit 72ae2320d1
8 changed files with 34 additions and 6 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,7 +32,12 @@ 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):
@ -46,5 +52,7 @@ class OAuthAdapter(OAuth2Adapter):
return f"https://{self.domain}/api/me/"
OAuthProvider.oauth2_adapter_class = OAuthAdapter
oauth2_login = OAuth2LoginView.adapter_view(OAuthAdapter)
oauth2_callback = OAuth2CallbackView.adapter_view(OAuthAdapter)