-
-
Notifications
You must be signed in to change notification settings - Fork 228
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
Trailing '==' in a token breaks verify_token() #164
Comments
Flask-HTTPAuth does not parse authentication, Flask does (or actually, Werkzeug). If your token isn't recognized, it is because Werkzeug decided the Authorization header that your client is sending is invalid. The parser for the Authorization header has changed in recent versions of Werkzeug, and it is stricter than before. Some invalid formats for this header were allowed before, but they are rejected now. I suggest you review the header that your client is sending, and if you are sure it is correct, try it with different versions of Werkzeug and report your findings to the Flask team. |
Thank you very much for the fast answer. If Werkzeug decided to be stricter, that's probably for good reasons I'll see if I can modify internally the way the tokens are created to converge towards a correct/standard format Again, thank you for your time. |
@lordslair The |
Hello,
As far as I could test it, it seems that using
HTTPTokenAuth
with a custom scheme doesn't support having the string '==' at the end of a tokenI know it's not an usual token format, so here some exemples:
N2RmYmWmNDY1Nw==
is not recognized in theverify_token(token)
though
N2RmYmWmNDY1Nw=
OKN2RmYm==WmNDY1Nw
OKI'm not sure it's a bug, or if it works as intended and the token of a legacy app I use shouldn't be formed like that
But I wanted to raise the issue, just in case that's a not wanted behaviour
And to give more details, these kind of tokens
N2RmYmWmNDY1Nw==
were perfectly recognized in previous versions(up to ~4.3.0 I'd say)
It's reproductible using your documentation and my exemple 'faulty' token: https://flask-httpauth.readthedocs.io/en/latest/#token-authentication-example
Inside this block, the variable
token
isNone
Thanks in advance
The text was updated successfully, but these errors were encountered: