googleapis / google-api-php-client

A PHP client library for accessing Google APIs
Apache License 2.0
9.2k stars 3.52k forks source link

Ayuda token google api calendar #2511

Closed Topin97 closed 8 months ago

Topin97 commented 9 months ago

Hola estoy creando una aplicación web con streamlit para agendar citas , ya tengo todo configurado. Tengo un problema al generar el token de Google, lo genero y funciona bien pero a la hora me da error la página , aquí dejo el código con el que genero el token.

import pickle 
 import os.path 
 from google_auth_oauthlib.flow import InstalledAppFlow 
 from googleapiclient.discovery import build 

 SCOPES = ['https://www.googleapis.com/auth/calendar'] 

 def main(): 
     """Muestra eventos próximos del calendario de usuario.""" 
     creds = None 
     # El archivo token.pickle guarda las credenciales del usuario 
     if os.path.exists('token.pickle'): 
         with open('token.pickle', 'rb') as token: 
             creds = pickle.load(token) 
     # Si no hay credenciales válidas, hacer login. 
     if not creds or not creds.valid: 
         if creds and creds.expired and creds.refresh_token: 
             creds.refresh(Request()) 
         else: 
             flow = InstalledAppFlow.from_client_secrets_file( 
                 'credentials.json', SCOPES) 
             creds = flow.run_local_server(port=8080) 
         # Guardar las credenciales para la próxima corrida 
         with open('token.pickle', 'wb') as token: 
             pickle.dump(creds, token) 
 if __name__ == '__main__': 
     main()

Lo podéis comprobar en la web https://newstyle23.streamlit.app/

Error google.auth.exceptions.RefreshError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you're on Streamlit Cloud, click on 'Manage app' in the lower right of your app)

Espero que me pueda ayudar alguien , llevo todo el día creando token nuevo...

saranshdhingra commented 8 months ago

Hi there. This is the repository for the PHP API client :)

Please use the python repository for python related issues.