'Invalid scopes in google quickstart application

I have an application that serves to add slides from my PC into a google slides file, and it relies on the following code to check authorization:

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

and where the variable SCOPES is set as:

SCOPES = 'https://www.googleapis.com/auth/drive'

or - it does not change the outcome

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

and the credentials are :

{"installed":{"client_id":"162352680285-0i0fmpq50gqgsm1d796mmdim3c3oe874.apps.googleusercontent.com","project_id":"quickstart-1613196175693","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":"REDACTED","redirect_uris":["urn:ietf:wg:oauth:2.0:oob","http://localhost"]}}

The program runs into an exception

 raise exceptions.RefreshError(error_details, response_body)
google.auth.exceptions.RefreshError: ('invalid_scope: Some requested scopes were invalid. 

This is surprising because the program ran error free till recently



Solution 1:[1]

Issue:

SCOPES should be a list of scopes, not a string:

scopes (Sequence[str]): The list of scopes to request during the flow.

Solution:

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

Reference:

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Iamblichus