| 1 |
from __future__ import annotations |
| 2 |
|
| 3 |
from allauth.socialaccount.providers.base import ProviderAccount |
| 4 |
from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider |
| 5 |
from allauth.socialaccount.providers.twentythreeandme.views import ( |
| 6 |
TwentyThreeAndMeOAuth2Adapter, |
| 7 |
) |
| 8 |
|
| 9 |
|
| 10 |
class TwentyThreeAndMeAccount(ProviderAccount): |
| 11 |
pass |
| 12 |
|
| 13 |
|
| 14 |
class TwentyThreeAndMeProvider(OAuth2Provider): |
| 15 |
id = "twentythreeandme" |
| 16 |
slug = "23andme" |
| 17 |
name = "23andMe" |
| 18 |
account_class = TwentyThreeAndMeAccount |
| 19 |
oauth2_adapter_class = TwentyThreeAndMeOAuth2Adapter |
| 20 |
|
| 21 |
def extract_uid(self, data): |
| 22 |
return data["id"] |
| 23 |
|
| 24 |
def get_default_scope(self): |
| 25 |
scope = ["basic"] |
| 26 |
return scope |
| 27 |
|
| 28 |
def extract_common_fields(self, data): |
| 29 |
return dict( |
| 30 |
email=data.get("email"), |
| 31 |
) |
| 32 |
|
| 33 |
|
| 34 |
provider_classes = [TwentyThreeAndMeProvider] |