o
    i                     @   sL   d Z ddlmZmZmZ ddlmZmZmZ erddl	Z	G dd deZ
dS )zSpotify SSO Login Helper.    )TYPE_CHECKINGClassVarOptional)DiscoveryDocumentOpenIDSSOBaseNc                   @   sP   e Zd ZU dZdZddgZeed< defddZ	dd
e
ded defddZd	S )
SpotifySSOz(Class providing login via Spotify OAuth.Zspotifyzuser-read-privatezuser-read-emailscopereturnc                    s   ddddS )z#Get document containing handy urls.z&https://accounts.spotify.com/authorizez&https://accounts.spotify.com/api/tokenzhttps://api.spotify.com/v1/me)Zauthorization_endpointZtoken_endpointZuserinfo_endpoint )selfr   r   N/home/app/Keep/.python/lib/python3.10/site-packages/fastapi_sso/sso/spotify.pyget_discovery_document   s
   z!SpotifySSO.get_discovery_documentNresponsesessionzhttpx.AsyncClientc                    sH   | dg r|d d d nd}t| d| d| j| d|dS )	z8Return OpenID from user information provided by Spotify.Zimagesr   urlNemaildisplay_nameid)r   r   providerr   picture)getr   r   )r   r   r   r   r   r   r   openid_from_response   s    zSpotifySSO.openid_from_response)N)__name__
__module____qualname____doc__r   r	   r   __annotations__r   r   dictr   r   r   r   r   r   r   r      s   
  r   )r   typingr   r   r   Zfastapi_sso.sso.baser   r   r   Zhttpxr   r   r   r   r   <module>   s    