This repository was archived by the owner on Jun 23, 2023. It is now read-only.
This repository was archived by the owner on Jun 23, 2023. It is now read-only.
WrongTokenClass bug #97
Closed
Description
I stumbled onto the followin bug.
I try to run a regular code flow. When I try to exchange the authorization code with an access_token the following error is raised:
File "/srv/venv/lib/python3.7/site-packages/oidcop/oauth2/token.py", line 407, in process_request
_access_token, grant=True
File "/srv/venv/lib/python3.7/site-packages/oidcop/session/manager.py", line 459, in get_session_info_by_token
_token_info = self.token_handler.info(token_value)
File "/srv/venv/lib/python3.7/site-packages/oidcop/token/handler.py", line 55, in info
_handler, item_info = self.get_handler(item, order)
File "/srv/venv/lib/python3.7/site-packages/oidcop/token/handler.py", line 75, in get_handler
res = self.handler[typ].info(token)
File "/srv/venv/lib/python3.7/site-packages/oidcop/token/__init__.py", line 117, in info
raise WrongTokenClass(_res["token_class"])
oidcop.token.exception.WrongTokenClass: access_token
The bug happens because the authorization code and the access_token are created using the same class (DefaultToken
).
So
oidc-op/src/oidcop/token/__init__.py
Line 108 in 0f92cfb
oidc-op/src/oidcop/token/__init__.py
Line 117 in 0f92cfb
To reproduce it you must use DefaultToken for both access token and authorization code (which is the default)