0
votes

I recently decided to quickly re-setup google identity toolkit using a new application, which I thought would be a walk in the park until I became stranded on the 401 Unauthorized error below...

To make sure this was a clean setup, I followed the step-by-step setup instructions exactly (https://developers.google.com/identity/toolkit/web/configure-service) including the step of converting the .p12 file to .pem with openssl pkcs12 -in xxxxx.p12 -nodes -nocerts > privatekey.pem

As a side note, I previously had this up and running perfectly a couple of months back and can't seem to identify the error this time round.. Thought it must be the .pem file so I tried using the .p12 and even the .json rsa file but I'm guessing gitkit still can't accept those options

Any ideas?

HTTP Error 401: Unauthorized Traceback (most recent call last): File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1529, in call rv = self.router.dispatch(request, response) File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1278, in default_dispatcher return route.handler_adapter(request, response) File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1101, in call handler = self.handler(request, response) File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 528, in init self.initialize(request, response) File "/base/data/home/apps/s~[site]/1.391420460413032384/main.py", line 56, in initialize gitkit_user = gitkit_instance.VerifyGitkitToken(self.request.cookies['gtoken'])
File "/base/data/home/apps/s~[site]/1.391420460413032384/lib/identitytoolkit/gitkitclient.py", line 216, in VerifyGitkitToken certs = self.rpc_helper.GetPublicCert() File "/base/data/home/apps/s~[site]/1.391420460413032384/lib/identitytoolkit/rpchelper.py", line 157, in GetPublicCert headers = {'Authorization': 'Bearer ' + self._GetAccessToken()} File "/base/data/home/apps/s~[site]/1.391420460413032384/lib/identitytoolkit/rpchelper.py", line 207, in _GetAccessToken raw_response = urllib2.urlopen(req, body) File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/urllib2.py", line 127, in urlopen return _opener.open(url, data, timeout) File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/urllib2.py", line 410, in open response = meth(req, response) File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/urllib2.py", line 523, in http_response 'http', request, response, code, msg, hdrs) File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/urllib2.py", line 448, in error return self._call_chain(*args) File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/urllib2.py", line 382, in _call_chain result = func(*args) File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/urllib2.py", line 531, in http_error_default raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) HTTPError: HTTP Error 401: Unauthorized

1
Is it fair to assume this is a problem with the setup of the service account or the reference to the service account? - Dennis

1 Answers

0
votes

Ok, have figured it out.. Looks like needed to update the gitkit client to the version from Dec 2015 (was using Sep 2015), which no longer needs the conversion from .p12 to .pem