Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Flask does not like 'AddressClaim' #65

@tomasbrchan

Description

@tomasbrchan

Hi,
I found out that my app stopped working, because of different response from OpenId server.
I found out they added more information to 'profile' and one of these is 'addesss'.
From that moment this error occurs:

Traceback (most recent call last):
File "C:\Python310\Lib\site-packages\flask\app.py", line 2091, in call
return self.wsgi_app(environ, start_response)
File "C:\Python310\Lib\site-packages\flask\app.py", line 2076, in wsgi_app
response = self.handle_exception(e)
File "C:\Python310\Lib\site-packages\flask\app.py", line 2073, in wsgi_app
response = self.full_dispatch_request()
File "C:\Python310\Lib\site-packages\flask\app.py", line 1519, in full_dispatch_request
return self.finalize_request(rv)
File "C:\Python310\Lib\site-packages\flask\app.py", line 1540, in finalize_request
response = self.process_response(response)
File "C:\Python310\Lib\site-packages\flask\app.py", line 1888, in process_response
self.session_interface.save_session(self, ctx.session, response)
File "C:\Python310\Lib\site-packages\flask\sessions.py", line 406, in save_session
val = self.get_signing_serializer(app).dumps(dict(session)) # type: ignore
File "C:\Python310\Lib\site-packages\itsdangerous\serializer.py", line 207, in dumps
payload = want_bytes(self.dump_payload(obj))
File "C:\Python310\Lib\site-packages\itsdangerous\url_safe.py", line 53, in dump_payload
json = super().dump_payload(obj)
File "C:\Python310\Lib\site-packages\itsdangerous\serializer.py", line 169, in dump_payload
return want_bytes(self.serializer.dumps(obj, **self.serializer_kwargs))
File "C:\Python310\Lib\site-packages\flask\json\tag.py", line 308, in dumps
return dumps(self.tag(value), separators=(",", ":"))
File "C:\Python310\Lib\site-packages\flask\json_init_.py", line 139, in dumps
rv = json.dumps(obj, **kwargs)
File "C:\Python310\Lib\json_init
.py", line 238, in dumps
**kw).encode(obj)
File "C:\Python310\Lib\json\encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "C:\Python310\Lib\json\encoder.py", line 257, in iterencode
return iterencode(o, 0)
File "C:\Python310\Lib\site-packages\flask\json_init
.py", line 57, in default
return super().default(o)
File "C:\Python310\Lib\json\encoder.py", line 179, in default
raise TypeError(f'Object of type {o.class.name} '
TypeError: Object of type AddressClaim is not JSON serializable

I deleted line 572: "address": OPTIONAL_ADDRESS, in .venv\Lib\site-packages\oidcmsg\oidc_init_.py and everything works fine again. I do not need optional address for my app.
But it's not a solution and there is no option to disable that and I need at least basic profile of the user.

I could not find where the problem is. Any idea?
Tomas

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions