| 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.robinhood.views import RobinhoodOAuth2Adapter |
| 6 |
|
| 7 |
|
| 8 |
class RobinhoodAccount(ProviderAccount): |
| 9 |
def get_avatar_url(self): |
| 10 |
return None |
| 11 |
|
| 12 |
|
| 13 |
class RobinhoodProvider(OAuth2Provider): |
| 14 |
id = "robinhood" |
| 15 |
name = "Robinhood" |
| 16 |
account_class = RobinhoodAccount |
| 17 |
oauth2_adapter_class = RobinhoodOAuth2Adapter |
| 18 |
|
| 19 |
def get_default_scope(self): |
| 20 |
return ["read"] |
| 21 |
|
| 22 |
def extract_uid(self, data): |
| 23 |
return data["id"] |
| 24 |
|
| 25 |
def extract_common_fields(self, data): |
| 26 |
return dict(username=data.get("username")) |
| 27 |
|
| 28 |
|
| 29 |
provider_classes = [RobinhoodProvider] |