
    |V
h                         S SK Jr  S SKJr  S SKrS SKJr  S SKrS SKJ	r	  \" 5         \R                  " S5      r\	R                  " 5       r\	" \5      rS\S\4S	 jrS
\S\4S jrS\4S jrg)    )id_token)requestsN)load_dotenv)FernetGOOGLE_CLIENT_IDrefresh_tokenreturnc                 d    [         R                  U R                  5       5      R                  5       $ N)cipher_suiteencryptencodedecode)r   s    LC:\Suresh\moveshuttle\MDcreated\moveengine\app\v1\libraries\googleconnect.pyencrypt_refresh_tokenr      s%     4 4 67>>@@    encrypted_refresh_tokenc                 d    [         R                  U R                  5       5      R                  5       $ r   )r   decryptr   r   )r   s    r   decrypt_refresh_tokenr      s&     7 > > @AHHJJr   tokenc                 .    [         R                  " U [        R                  " 5       [        5      nUS   S;  a  [        S5      eSn[        U5      nUS   UR                  S5      UR                  S5      US   US	.nU$ ! [
         a
  n S nAg S nAff = f)
Niss)zaccounts.google.comzhttps://accounts.google.comzWrong issuer.z!your-oauth-flow-needs-to-set-thisemailnamepicturesub)r   r   r   	google_idr   )r   verify_oauth2_tokenr   Requestr   
ValueErrorr   get)r   idinfor   r   	user_infoerrors         r   verify_google_tokenr&      s    --eX5E5E5GIYZ%= VV_-- < #8"F G_JJv&zz),4
	  s   A=B   
BB)google.oauth2r   google.auth.transportr   osdotenvr   loggingcryptography.fernetr   getenvr   generate_key
fernet_keyr   strr   r   r&    r   r   <module>r2      s~    " * 	   & 99/0 
   "
j!A A AK3 K3 Ks r   