This page describes some common issues that you might encounter involving authentication and authorization.
This app isn't verified
If the OAuth consent screen displays the warning "This app isn't verified," your app is requesting scopes that provide access to sensitive user data. If your application uses sensitive scopes, your app must go through the verification process to remove that warning and other limitations. During the development phase, you can continue past this warning by selecting Advanced > Go to {Project Name} (unsafe).
File not found error for credentials.json
When running the code sample, you might receive a "file not found" or "no such file" error message regarding credentials.json.
This error occurs when you have not authorized the desktop application credentials. To learn how to create credentials for a desktop application, go to Create credentials.
After you create the credentials, make sure the downloaded JSON file is saved as
credentials.json
. Then move the file to your working directory.
Token has been expired or revoked
When running the code sample, you might receive a "Token has been expired" or "Token has been revoked" error message.
This error occurs when an access token from the Google Authorization Server has either expired or has been revoked. For information about potential causes and fixes, see Refresh token expiration.
Python errors
The following are some common Python errors.
AttributeError: 'Module_six_moves_urllib_parse' object has no attribute 'urlparse'
This error can occur in Mac OSX where the default installation of the six
module (a dependency of the Python library) is loaded before the one that pip
installed. To fix the issue, add pip's install location to the PYTHONPATH
system environment variable:
Determine pip's install location:
pip show six | grep "Location:" | cut -d " " -f2
Make a note of this location because it's needed for the next step.
Add the following line to your
~/.bashrc
file, replacingINSTALL_PATH
with the location determined from the previous step:export PYTHONPATH=$PYTHONPATH:INSTALL_PATH
Reload your
~/.bashrc
file:source ~/.bashrc
TypeError: sequence item 0: expected str instance, bytes found
This error is due to a bug in httplib2
. To resolve this problem, upgrade
to the latest version of httplib2
:
pip install --upgrade httplib2
Cannot uninstall 'six'
When running the pip install
command, you might receive the following error:
Cannot uninstall 'six'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
This error occurs on Mac OSX when pip attempts to upgrade the pre-installed
six
package. To work around this issue, add the flag
--ignore-installed six
to the pip install
command.