JSONDecodeError when calling UsersClient.get_user()


#1

Hello - below is a snippet of my code which has been running fine for a long time, and randomly raised an error today. Does anyone know what caused it?

from flask_oids import OpenIDConnect
from okta import UsersClient
from flask import g

oidc = OpenIDConnect(app)
okta_client = UsersClient(…)

@app.before_request
def before_request():
if oidc.user_loggedin:
g.user = okta_client.get_user(oidc.user_getfield(“sub”))
else:
g.user = None

I’m on localhost. Here’s my error trace:

File “…\Python36-32\lib\site-packages\flask\app.py”, line 1997 , in __call__
return self.wsgi_app(environ, start_response)
File “…\Python36-32\lib\site-packages\flask\app.py”, line 1985 , in wsgi_app
response = self.handle_exception(e)

g.user = okta_client.get_user(oidc.user_getfield(“sub”))
File “…\Python36-32\lib\site-packages\okta\UsersClient.py”, line 44 , in get_user
response = ApiClient.get_path(self, ‘/{0}’.format(uid))
File “…\Python36-32\lib\site-packages\okta\framework\ApiClient.py”, line 82 , in get_path
return self.get(self.base_url + url_path, params)
File “…\Python36-32\lib\site-packages\okta\framework\ApiClient.py”, line 45 , in get
if self._check_response(resp, attempts):
File “…\Python36-32\lib\site-packages\okta\framework\ApiClient.py”, line 102 , in __check_response
raise OktaError(json.loads(resp.text))
File "…\Python36-32\lib\json_init
.py", line 354 , in loads
return _default_decoder.decode(s)
File “…\Python36-32\lib\json\decoder.py”, line 339 , in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “…\Python36-32\lib\json\decoder.py”, line 357 , in raw_decode
raise JSONDecodeError(“Expecting value”, s, err.value) from None

Thanks for the help!