HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/aigenerator/venv/lib/python3.12/site-packages/social_core/backends/quizlet.py
"""
Quizlet OAuth2 Sign-in backend, docs at:
    https://python-social-auth.readthedocs.io/en/latest/backends/quizlet.html
"""

from .oauth import BaseOAuth2


class QuizletOAuth2(BaseOAuth2):
    """Quizlet OAuth2"""

    name = "quizlet"
    ID_KEY = "user_id"
    API_URL = "https://api.quizlet.com/2.0/"
    AUTHORIZATION_URL = "https://quizlet.com/authorize"
    ACCESS_TOKEN_URL = "https://api.quizlet.com/oauth/token"
    ACCESS_TOKEN_METHOD = "POST"
    SCOPE_SEPARATOR = " "
    DEFAULT_SCOPE = ["read"]

    def get_user_details(self, response):
        """Return user details from Quizlet account"""
        return {"username": response.get("user_id")}