Access blocked: This app’s request is invalid:
I am just trying to read data using the follwoing python code:
SCOPES = ['https://www.googleapis.com/auth/spreadsheets.readonly']
# The ID and range of a sample spreadsheet.
SAMPLE_SPREADSHEET_ID = 'SAMPLE_SPREADSHEET_ID'
SAMPLE_RANGE_NAME = 'rng!A:B'
"""Shows basic usage of the Sheets API.
Prints values from a sample spreadsheet.
"""
creds = None
# The file token.json stores the user's access and refresh tokens,
and is
# created automatically when the authorization flow completes for
the first
# time.
if os.path.exists('token.json'):
creds = Credentials.from_authorized_user_file('token.json',
SCOPES)
# If there are no (valid) credentials available, let the user log
in.
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)
# Save the credentials for the next run
with open('token.json', 'w') as token:
token.write(creds.to_json())
I always get the same error stating invalid sign in and the access is
denied.
The problem is, exactly the same settings are applied to other projects and
they work just fine.
can anyone help with this?
P.S: I checked this documentation too but it did not help
much:https://developers.google.com/identity/protocols/oauth2/web-server#python_4
--
You received this message because you are subscribed to the Google Groups
"Google Spreadsheets API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-spreadsheets-api/8035468b-2268-457c-a53e-b08d23d1c548n%40googlegroups.com.