Skip to content

Trailing '==' in a token breaks verify_token() #164

@lordslair

Description

@lordslair

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 token

I know it's not an usual token format, so here some exemples:
N2RmYmWmNDY1Nw== is not recognized in the verify_token(token)
though
N2RmYmWmNDY1Nw= OK
N2RmYm==WmNDY1Nw OK

I'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 is None

@auth.verify_token
def verify_token(token):
    if token in tokens:
        return tokens[token]

Thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions