[Qgis-user] Self inflicted python token revoke error: Python - google.auth.exceptions.RefreshError: ('invalid_grant: Token has been expired or revoked...…..)

Sean Hill seanhillsa at gmail.com
Mon Jun 1 03:03:16 PDT 2020


Unfortunate, self-inflicted problem, for which help would be appreciated.



SYSTEM

QGIS Version 3.12.3 Bucuresti

Installation from QGIS-OSGeo4W-3.12.3-1-Setup-x86_64.exe as a standalone
version

QGIS broke when installing plug-ins (see below)

OS - Windows 7 Home



PROBLEM DESCRIPTION

   - Program was working well and had been used successfully for several
   days until then trying to install Google Earth, Google Maps and OpenLayers.
   - Installed plug-ins, received a Python URL (with instruction to Copy
   and Paste into QGIS, which was done).
   - Then received a Google Security message via email asking whether it
   was me.
   - Accepted this, but then subsequently a few minutes later, because of a
   security concern (now admittedly unwarranted!) went into Google account and
   revoked access to Python (at that stage not understanding that this is a
   program requirement!).  I am now unable to run QGIS.



FIXES ATTEMPTED

   - Have tried Uninstalling QGIS and re-installing, to no effect.
   - Tried Uninstalling and manually cleaning up “debris folders & files”
   left by Windows before re-installing, again to no effect.
   - Have searched methods of re-obtaining Python token, most of which
   indicate a requirement to contact the app supplier to re-obtain a new one.
   - Have seen that an API OAuth 2.0 is a possible solution, but have no
   idea as to how this could / would be used with QGIS.



EXPECTATION

To obtain a new Python token from Google via QGIS to allow QGIS to be
reinstalled successfully.



ERROR SOURCE INFORMATION

The following error information has been copied from QGIS:



*Couldn't load plugin 'ee_plugin' due to an error when calling its
classFactory() method*

*google.auth.exceptions.RefreshError: ('invalid_grant: Token has been
expired or revoked.', '{\n  "error": "invalid_grant",\n
"error_description": "Token has been expired or revoked."\n}')*

Traceback (most recent call last):
  File "C:/PROGRA~1/QGIS3~1.12/apps/qgis/./python\qgis\utils.py", line 334,
in _startPlugin
    plugins[packageName] = package.classFactory(iface)
  File
"C:/Users/Sean/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\__init__.py",
line 25, in classFactory
    from .ee_plugin import GoogleEarthEnginePlugin
  File "C:/PROGRA~1/QGIS3~1.12/apps/qgis/./python\qgis\utils.py", line 743,
in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File
"C:/Users/Sean/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\ee_plugin.py",
line 26, in
    ee_plugin.ee_auth.init()
  File
"C:/Users/Sean/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\ee_auth.py",
line 19, in init
    ee.Initialize()
  File
"C:\Users\Sean\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\__init__.py",
line 123, in Initialize
    ApiFunction.initialize()
  File
"C:\Users\Sean\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\apifunction.py",
line 154, in initialize
    signatures = data.getAlgorithms()
  File
"C:\Users\Sean\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\data.py",
line 952, in getAlgorithms
    return send_('/algorithms', {}, 'GET')
  File
"C:\Users\Sean\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\data.py",
line 1762, in send_
    response, content = send_with_backoff()
  File
"C:\Users\Sean\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\data.py",
line 1753, in send_with_backoff
    url, method=opt_method, body=payload, headers=headers)
  File
"C:\Users\Sean\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\google_auth_httplib2.py",
line 187, in request
    self._request, method, uri, request_headers)
  File
"C:\Users\Sean\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\google\auth\credentials.py",
line 124, in before_request
    self.refresh(request)
  File
"C:\Users\Sean\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\google\oauth2\credentials.py",
line 152, in refresh
    self._scopes,
  File
"C:\Users\Sean\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\google\oauth2\_client.py",
line 241, in refresh_grant
    response_data = _token_endpoint_request(request, token_uri, body)
  File
"C:\Users\Sean\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\google\oauth2\_client.py",
line 115, in _token_endpoint_request
    _handle_error_response(response_body)
  File
"C:\Users\Sean\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\google\oauth2\_client.py",
line 60, in _handle_error_response
    raise exceptions.RefreshError(error_details, response_body)
google.auth.exceptions.RefreshError: ('invalid_grant: Token has been
expired or revoked.', '{\n  "error": "invalid_grant",\n
"error_description": "Token has been expired or revoked."\n}')


*Python version:* 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC
v.1914 64 bit (AMD64)]
*QGIS version:* 3.12.3-București București, 8234261527

*Python Path:*

·                     C:/PROGRA~1/QGIS3~1.12/apps/qgis/./python

·
C:/Users/Sean/AppData/Roaming/QGIS/QGIS3\profiles\default/python

·
C:/Users/Sean/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins

·                     C:/PROGRA~1/QGIS3~1.12/apps/qgis/./python/plugins

·                     C:\PROGRA~1\QGIS3~1.12\apps\Python37

·                     C:\PROGRA~1\QGIS3~1.12\apps\Python37\Scripts

·                     C:\Program Files\QGIS 3.12\bin\python37.zip

·                     C:\PROGRA~1\QGIS3~1.12\apps\Python37\DLLs

·                     C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib

·                     C:\Program Files\QGIS 3.12\bin

·                     C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\site-packages

·
C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\site-packages\win32

·
C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\site-packages\win32\lib

·
C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\site-packages\Pythonwin

·
C:/Users/Sean/AppData/Roaming/QGIS/QGIS3\profiles\default/python

C:\Users\Sean\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows



CONCLUSION

Assistance in obtaining a new Python token and / or guiding me to a
solution required, please.



Kind regards,

Sean Hill
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20200601/c6f20763/attachment.html>


More information about the Qgis-user mailing list