Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting an exception while using authorize() method #605

Open
nirajsp47 opened this issue Feb 12, 2025 · 0 comments
Open

Getting an exception while using authorize() method #605

nirajsp47 opened this issue Feb 12, 2025 · 0 comments

Comments

@nirajsp47
Copy link

Hi, I am getting a Refresh error exception when I try to execute the authorize() method.

  raise exceptions.RefreshError(
google.auth.exceptions.RefreshError: ('invalid_client: Unauthorized', {'error': 'invalid_client', 'error_description': 'Unauthorized'

I am passing the "client_secret.json" file as a parameter :

gc = pygsheets.authorize(client_secret="client_secret.json")

Surprisingly, when I use the same json file renamed as "credentials.json" in basic example provided by ghseets, I dont see any issue.

 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
      ) 

My json file is in this format :


{"installed":
   {
   "client_id":"",
   "project_id":"",
   "auth_uri":"https://accounts.google.com/o/oauth2/auth",
   "token_uri":"https://oauth2.googleapis.com/token",
   "auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs",
   "client_secret":"",
   "redirect_uris":
   }
}

Can you please help to understand what am I missing?
Is there a possibility that the json file format from google has changed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant