Token is `None` in containerized setup
question
Posting here as I'm struggling to find information in other corners of the web.
I'm running Flask on a Kubernetes Pod and struggling to properly authenticate my requests.
```
auth = HTTPTokenAuth(scheme="Bearer")
@auth.verify_token
def auth_verify_token(token: str):
# ^ here I receive a value of `None`
return "user"
# app setup, etc...
@app.route("/test", methods=["GET"])
def test():
print(request.headers.get('Authorization')) # prints "Bearer <token>" as expected
return "OK"
@app.route("/test2", methods=["GET"])
@auth.login_required
def test2():
# this code is never run, as we get a 401 based on the issue above
return "OK"
```
I should note that when I run this setup locally via `flask run` everything works as expected.
Any hints, tips, suggestions greatly appreciated.
16 条评论