
    f                     B    d dl mZ d dlmZ d dlmZmZ  G d de      Zy)    )app_settings)get_adapter)OAuth2ClientOAuth2Errorc                       e Zd ZdZddZy)UntappdOAuth2Clientz
    Custom client because Untappd:
        * uses redirect_url instead of redirect_uri
        * nests access_token inside an extra 'response' object
    Nc                 B   ddl m} | j                  | j                  dd| j                  |d}d }| j                  |       | j                  }| j                  dk(  r|}d }|r|r||d<   t        j                  j                  |j                  i       }d|j                  d	d
      i}t               j                         j                  | j                  ||||      }	d }
|	j                  dk(  r|	j!                         d   }
|
rd|
vrt#        d|	j$                  z        |
S )Nr   )UntappdProviderauthorization_codecode)	client_idredirect_url
grant_typeresponse_typeclient_secretr   GETcode_verifierz
User-Agent
USER_AGENTzdjango-allauth)paramsdataheaders   responseaccess_tokenz!Error retrieving access token: %s)0allauth.socialaccount.providers.untappd.providerr
   consumer_keycallback_urlconsumer_secret_strip_empty_keysaccess_token_urlaccess_token_methodr   	PROVIDERSgetidr   get_requests_sessionrequeststatus_codejsonr   content)selfr   pkce_code_verifierr
   r   r   urlsettingsr   respr   s              i/var/www/cs2snipe.com/venv/lib/python3.12/site-packages/allauth/socialaccount/providers/untappd/client.pyget_access_tokenz$UntappdOAuth2Client.get_access_token   s3   	

 ** --.#!11
 t$####u,FD&$6D!))--o.@.@"El<L!MN M!!#W((   	 s"99;z2L~\AADLLPQQ    )N)__name__
__module____qualname____doc__r0    r1   r/   r   r   	   s    )r1   r   N)allauth.socialaccountr   allauth.socialaccount.adapterr   -allauth.socialaccount.providers.oauth2.clientr   r   r   r6   r1   r/   <module>r:      s    . 50, 0r1   