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

Richard Duivenvoorde rdmailings at duif.net
Tue Jun 2 05:25:13 PDT 2020


Not sure what you mean by a Python toke, as I only am aware of Google
tokens...
So what I think is that a (Google-related) plugin is creating havoc.

So you could rename your profiles folder:

 C:/Users/Sean/AppData/Roaming/QGIS/QGIS3\profiles

Restart QGIS (which then should give you a fresh profile) and see if
that helps.
IF that is ok, and you miss your old settings/plugins you could try to
remove google related stuff from python/plugins...

HTH

Richard Duivenvoorde

On 6/1/20 12:03 PM, Sean Hill wrote:
> 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
> 
> 
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
> 



More information about the Qgis-user mailing list