2

I am developing a Google Workspace addon for Google Drive in python. I have the deployment set up and the addon installed (it is unpublished). The deployment is set up such that when a user clicks an item it runs a function that is supposed to generate an authentication token.

Following the python quickstart for the Gmail API, I have to generate an access token before building a gmail service. Here is said article: https://developers.google.com/gmail/api/quickstart/python

When I click on my addon's icon image the homepage loads in the right-side side-panel. The problem is, after that, when a user clicks an item the side-panel loads with a text saying "Timeout receiving HTTP content."

After digging around in the logs I have discovered that the user needs to be directed to the Google Oauth consent screen ("to authorize the app go to this link") but that does not happen within the side-panel.

The code that is supposed to do this is:

flow = InstalledAppFlow.from_client_secrets_file('credentials.json', scopes)
creds = flow.run_local_server(port=0) 

Is there are a way of directing the user to the link from the side-panel?

Edit: The app itself is authorized, however what I want to do is create a service object of Gmail by running:

service = build("gmail", "v1", credentials=creds)

I am doing this in a function that runs when a user clicks on a file. This is so that I can get the credentials (the variable called creds).

TailonR
  • 23
  • 5

0 Answers0