Debian Codegraph @

allauth/socialaccount/providers/hubic/provider.py

raw
1 from __future__ import annotations
2
3 from allauth.socialaccount.providers.base import ProviderAccount
4 from allauth.socialaccount.providers.hubic.views import HubicOAuth2Adapter
5 from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider
6
7
8 class HubicAccount(ProviderAccount):
9 pass
10
11
12 class HubicProvider(OAuth2Provider):
13 id = "hubic"
14 name = "Hubic"
15 account_class = HubicAccount
16 oauth2_adapter_class = HubicOAuth2Adapter
17
18 def extract_uid(self, data):
19 return str(data["email"])
20
21 def extract_common_fields(self, data):
22 return dict(
23 email=data.get("email"),
24 username=data.get("firstname").lower() + data.get("lastname").lower(),
25 first_name=data.get("firstname"),
26 last_name=data.get("lastname"),
27 )
28
29
30 provider_classes = [HubicProvider]