Trying to use firebase auth as the authentication system. I have read through the verify ID token docs and went through the Firebase SDK Setup. Using GAE and Datastore as backend, Python and webapp2 framework.
Whenever trying to verify id token
decoded_claims = auth.verify_id_token(id_token)
I get the below warning and error (using Mac), error happens when using the auth module in general, ex: when trying to use get_user, get_user_by_email...etc.
Warning
Warning: urllib3 is using URLFetch on Google App Engine sandbox instead of sockets. To use sockets directly instead of URLFetch see https://urllib3.readthedocs.io/en/latest/reference/urllib3.contrib.html.
Error
File /<mypath>/lib/cachecontrol/adapter.py", line 26, in __init__
super(CacheControlAdapter, self).__init__(*args, **kw)
File "/<mypath>/lib/requests/adapters.py", line 121, in __init__
super(HTTPAdapter, self).__init__()
TypeError: super(type, obj): obj must be an instance or subtype of type
The error seems to be related to the libraries requests and cachecontrol and not something related to our code. My guess is that this is related to the installation of some libraries which may have been missing some dependencies. We install all libraries to a /lib folder under our project as indicated in the docs here using:
sudo pip install -t <path>/lib <library>
Including the installation for firebase-admin i.e. sudo pip install -t <path>/lib firebase-admin
Updated the Firebase SDK to 2.12.0, tried removing and reinstalling Firebase auth, read through Verify ID tokens using a third-party JWT library (still having problems getting it to work) which seems like a workaround rather than using the Admin SDK directly and makes more sense. Anyone knows a solution around the TypeError: super(type, obj): obj must be an instance or subtype of type error?
UPDATE 1
Reading through Another super() wrinkle – raising TypeError regarding the TypeError, I checked line 121 in the file adapters.py as logged in the error output
/lib/requests/adapters.py", line 123, in __init__
super(HTTPAdapter, self).__init__()
and added print statements as noted in the above blog
print "HTTPAdapter", HTTPAdapter
print isinstance(self, HTTPAdapter)
and got the same False output result!
HTTPAdapter <class 'requests_toolbelt.adapters.appengine.AppEngineAdapter'>
True
HTTPAdapter <class 'requests_toolbelt.adapters.appengine.AppEngineAdapter'>
True
HTTPAdapter <class 'requests_toolbelt.adapters.appengine.AppEngineAdapter'>
True
HTTPAdapter <class 'requests_toolbelt.adapters.appengine.AppEngineAdapter'>
True
HTTPAdapter <class 'requests_toolbelt.adapters.appengine.AppEngineAdapter'>
True
HTTPAdapter <class 'requests_toolbelt.adapters.appengine.AppEngineAdapter'>
True
HTTPAdapter <class 'requests_toolbelt.adapters.appengine.AppEngineAdapter'>
True
HTTPAdapter <class 'requests_toolbelt.adapters.appengine.AppEngineAdapter'>
True
HTTPAdapter <class 'requests_toolbelt.adapters.appengine.AppEngineAdapter'>
False
So apparently this seems to be called multiple times and isinstance is failing for the last call which is raising the error..
Not sure why no one else seem to have encountered that when using Firebase auth with those libraries..
requests-toolbelt, and followed the additional set up instructions for App Engine? google-auth.readthedocs.io/en/latest/…libfolder. I tried comparing some of the files from the system path to the ones in the GAElibfolder, ex:requests,cachecontrol,jwtbut I believe they are either the same version or the ones in thelibare actually the updates ones!superand module reload occurs in the code. Not sure, why no one else had this error as it seems related torequests/adapters.pymodule...pip install -t ./lib/ "firebase-admin==2.9.0"and function get_user_by_phone_number worked without errors! function verify_id_token is giving a permission denied error. Unfortunately, this means that the latest version doesn't work with this setup environment(!) that means newer functions like session cookies won't be accessible!