| 1 |
from __future__ import annotations |
| 2 |
|
| 3 |
from django.http import HttpRequest |
| 4 |
|
| 5 |
from ..oauth.views import OAuthAdapter, OAuthCallbackView, OAuthLoginView |
| 6 |
from .client import PocketOAuthClient |
| 7 |
|
| 8 |
|
| 9 |
class PocketOAuthAdapter(OAuthAdapter): |
| 10 |
provider_id = "pocket" |
| 11 |
request_token_url = "https://getpocket.com/v3/oauth/request" # nosec |
| 12 |
access_token_url = "https://getpocket.com/v3/oauth/authorize" # nosec |
| 13 |
authorize_url = "https://getpocket.com/auth/authorize" |
| 14 |
client_class = PocketOAuthClient |
| 15 |
|
| 16 |
def complete_login(self, request: HttpRequest, app, token, **kwargs): |
| 17 |
response = kwargs["response"] |
| 18 |
return self.get_provider().sociallogin_from_response(request, response) |
| 19 |
|
| 20 |
|
| 21 |
oauth_login = OAuthLoginView.adapter_view(PocketOAuthAdapter) |
| 22 |
oauth_callback = OAuthCallbackView.adapter_view(PocketOAuthAdapter) |