
    .ga                     Z    S r SSKrSSKrSSKJr  SSKrSSKr\" S5      r	S r
S rSS jrg)	a  Integration helpers.

This module provides helpers for integrating with `requests-oauthlib`_.
Typically, you'll want to use the higher-level helpers in
:mod:`google_auth_oauthlib.flow`.

.. _requests-oauthlib: http://requests-oauthlib.readthedocs.io/en/latest/
    N) external_account_authorized_user)auth_uri	token_uri	client_idc                     SU ;   a  U S   nOSU ;   a  U S   nO[        S5      e[        R                  UR                  5       5      (       d  [        S5      e[        R
                  " SUS   US.UD6nX@4$ )a  Creates a :class:`requests_oauthlib.OAuth2Session` from client
configuration loaded from a Google-format client secrets file.

Args:
    client_config (Mapping[str, Any]): The client
        configuration in the Google `client secrets`_ format.
    scopes (Sequence[str]): The list of scopes to request during the
        flow.
    kwargs: Any additional parameters passed to
        :class:`requests_oauthlib.OAuth2Session`

Raises:
    ValueError: If the client configuration is not in the correct
        format.

Returns:
    Tuple[requests_oauthlib.OAuth2Session, Mapping[str, Any]]: The new
        oauthlib session and the validated client configuration.

.. _client secrets:
    https://github.com/googleapis/google-api-python-client/blob/main/docs/client-secrets.md
web	installedz2Client secrets must be for a web or installed app.z,Client secrets is not in the correct format.r   )r   scope )
ValueError_REQUIRED_CONFIG_KEYSissubsetkeysrequests_oauthlibOAuth2Session)client_configscopeskwargsconfigsessions        aC:\Suresh\moveshuttle\MDcreated\moveengine\venv\Lib\site-packages\google_auth_oauthlib/helpers.pysession_from_client_configr   "   s    0 u%		%{+MNN ))&++-88GHH-- %V7=G !!    c                     [        U S5       n[        R                  " U5      nSSS5        [        WU40 UD6$ ! , (       d  f       N= f)ay  Creates a :class:`requests_oauthlib.OAuth2Session` instance from a
Google-format client secrets file.

Args:
    client_secrets_file (str): The path to the `client secrets`_ .json
        file.
    scopes (Sequence[str]): The list of scopes to request during the
        flow.
    kwargs: Any additional parameters passed to
        :class:`requests_oauthlib.OAuth2Session`

Returns:
    Tuple[requests_oauthlib.OAuth2Session, Mapping[str, Any]]: The new
        oauthlib session and the validated client configuration.

.. _client secrets:
    https://github.com/googleapis/google-api-python-client/blob/main/docs/client-secrets.md
rN)openjsonloadr   )client_secrets_filer   r   	json_filer   s        r    session_from_client_secrets_filer!   K   sA    & 
!3	'9		), 
( &mVFvFF 
(	's	   9
Ac                 B   Ub  UO0 nU R                   (       d  [        S5      eSU;   a  [        R                  " U R                   S   U R                   R	                  S5      UR	                  S5      UR	                  S5      UR	                  S5      UR	                  S5      U R
                  S	9nO[        R                  R                  R                  U R                   S   U R                   R	                  S5      U R                   R	                  S
5      UR	                  S5      UR	                  S5      UR	                  S5      U R
                  U R                   R	                  S5      S9n[        R                  R                  U R                   S   5      Ul        U$ )a.  Creates :class:`google.oauth2.credentials.Credentials` from a
:class:`requests_oauthlib.OAuth2Session`.

:meth:`fetch_token` must be called on the session before before calling
this. This uses the session's auth token and the provided client
configuration to create :class:`google.oauth2.credentials.Credentials`.
This allows you to use the credentials from the session with Google
API client libraries.

Args:
    session (requests_oauthlib.OAuth2Session): The OAuth 2.0 session.
    client_config (Mapping[str, Any]): The subset of the client
        configuration to use. For example, if you have a web client
        you would pass in `client_config['web']`.

Returns:
    google.oauth2.credentials.Credentials: The constructed credentials.

Raises:
    ValueError: If there is no access token in the session.
zDThere is no access token for this session, did you call fetch_token?3piaccess_tokenrefresh_tokenr   r   client_secrettoken_info_url)tokenr%   	token_urlr   r&   r'   r   id_tokenr
   )r%   r*   r   r   r&   r   granted_scopes
expires_at)r(   r   r   Credentialsgetr
   googleoauth2credentialsdatetimeutcfromtimestampexpiry)r   r   r1   s      r   credentials_from_sessionr5   d   s]   , &3%>MBM==U
 	
 6BB--/!--++O<#''4#''4'++O<(,,-=>==
 mm//;;MM.)!--++O<]]&&z2#''4#''4'++O<=="==,,W5 < 	
 "**;;GMM,<WXKr   )N)__doc__r2   r   google.authr   google.oauth2.credentialsr/   r   	frozensetr   r   r!   r5   r   r   r   <module>r:      s8      8   !"HI &"RG23r   