Debian Codegraph @

allauth/socialaccount/providers/notion/views.py

raw
1 from __future__ import annotations
2
3 from django.http import HttpRequest
4
5 from allauth.socialaccount.providers.oauth2.views import (
6 OAuth2Adapter,
7 OAuth2CallbackView,
8 OAuth2LoginView,
9 )
10
11 from .client import NotionOAuth2Client
12
13
14 class NotionOAuth2Adapter(OAuth2Adapter):
15 provider_id = "notion"
16 basic_auth = True
17 client_class = NotionOAuth2Client
18
19 authorize_url = "https://api.notion.com/v1/oauth/authorize"
20 access_token_url = "https://api.notion.com/v1/oauth/token" # nosec
21
22 def complete_login(self, request: HttpRequest, app, token, **kwargs):
23 return self.get_provider().sociallogin_from_response(
24 request, kwargs["response"]
25 )
26
27
28 oauth2_login = OAuth2LoginView.adapter_view(NotionOAuth2Adapter)
29 oauth2_callback = OAuth2CallbackView.adapter_view(NotionOAuth2Adapter)