o
    Lf(
                     @   s`   d dl mZ d dlmZ d dlmZmZmZ ddlm	Z	 G dd deZ
ee
Zee
ZdS )	    )get_adapter)ProviderException)OAuth2AdapterOAuth2CallbackViewOAuth2LoginView   )DataportenProviderc                   @   s*   e Zd ZejZdZdZdZdZ	dd Z
dS )DataportenAdapterz&https://auth.dataporten.no/oauth/tokenz.https://auth.dataporten.no/oauth/authorizationz#https://auth.dataporten.no/userinfoz(https://groups-api.dataporten.no/groups/c                 K   sb   dd|j  i}t  j| j|d}|  | d }| d |jkr)td| 	 
||S )a  
        Arguments:
            request - The get request to the callback URL
                        /accounts/dataporten/login/callback.
            app - The corresponding SocialApp model instance
            token - A token object with access token given in token.token
        Returns:
            Should return a dict with user information intended for parsing
            by the methods of the DataportenProvider view, i.e.
            extract_uid(), extract_extra_data(), and extract_common_fields()
        AuthorizationzBearer )headersuseraudiencezDataporten returned a user with an audience field                  which does not correspond to the client id of the                  application.)tokenr   get_requests_sessiongetprofile_urlraise_for_statusjson	client_idr   get_providersociallogin_from_response)selfrequestappr   kwargsr   userinfo_response
extra_data r   q/var/www/html/humari/django-venv/lib/python3.10/site-packages/allauth/socialaccount/providers/dataporten/views.pycomplete_login   s$   	z DataportenAdapter.complete_loginN)__name__
__module____qualname__r   idprovider_idaccess_token_urlauthorize_urlr   
groups_urlr   r   r   r   r   r	      s    r	   N)allauth.socialaccount.adapterr   $allauth.socialaccount.providers.baser   ,allauth.socialaccount.providers.oauth2.viewsr   r   r   providerr   r	   adapter_viewoauth2_loginoauth2_callbackr   r   r   r   <module>   s    
6