Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request.authorization["token"] is not set #2662

Closed
milen-yordanov opened this issue Apr 26, 2023 · 1 comment
Closed

request.authorization["token"] is not set #2662

milen-yordanov opened this issue Apr 26, 2023 · 1 comment

Comments

@milen-yordanov
Copy link

I have a project using
Flask==2.2.2
Flask-HTTPAuth==4.7.0

It was working fine. Today the tests started to fail without any source code change.

I traced the problem and looks like it is caused by these refactorings
#2619

Flask-HTTPAuth use a code like
https://github.com/miguelgrinberg/Flask-HTTPAuth/blob/main/src/flask_httpauth.py#L395
token = auth['token']

But now this returns None.
Now Authorization.from_headers() returns an object that has auth.token but does not work as auth['token']

Also see: miguelgrinberg/Flask-HTTPAuth#160

  • Python version: 3.9
  • Werkzeug version: 2.3.0
@davidism davidism added this to the 2.3.1 milestone Apr 26, 2023
@davidism davidism changed the title Authorization refactoring in version 2.3.0 is a breaking change from version 2.2.3 request.authorization["token"] is not set Apr 26, 2023
@davidism davidism removed this from the 2.3.1 milestone Apr 26, 2023
@davidism
Copy link
Member

OK, I see what's going on. Previously, we didn't support anything except basic and digest auth, and Flask-HTTPAuth worked around that by using a token key. However, now we actually support schemes with tokens, as auth.token. Looks like there's already a PR to address that, although they need to figure out compatibility: miguelgrinberg/Flask-HTTPAuth#159

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants