Why do I get "'OpenIDConnect' object has no attribute 'extra_data_serializer'" with Okta+oidc?

1.3k Views Asked by At

I try to integrate Okta in my Flask application with flask-oidc. The example app works fine with my client_secrets.json, but when I integrate this in my (larger) application, I get the following error:

Traceback (most recent call last):
  File "/home/math/.local/lib/python3.6/site-packages/flask/app.py", line 1949, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/math/.local/lib/python3.6/site-packages/flask/app.py", line 1935, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/math/.local/lib/python3.6/site-packages/flask_oidc/__init__.py", line 486, in decorated
    return self.redirect_to_auth_server(request.url)
  File "/home/math/.local/lib/python3.6/site-packages/flask_oidc/__init__.py", line 550, in redirect_to_auth_server
    state[statefield] = self.extra_data_serializer.dumps(
AttributeError: 'OpenIDConnect' object has no attribute 'extra_data_serializer'

Interestingly, I only get this error when I try to access a view protected by @oidc.require_login. When I first login and then access the protected view, it works fine. I would have expected the redirect (flask-oidc code), just as it happens for the non-blueprint view.

How can I make blueprints directly work with flask-oidc?

0

There are 0 best solutions below