Open mfrey777 opened 3 years ago
I have now seen that I could use the "audience" for the purpose explained above. But is there a way to pass the audience as parameter of jwt_required() (instead of having to set the object attribute directly beforehand) ?
@app.get('/user')
def user(Authorize: AuthJWT = Depends()):
Authorize._decode_audience = 't2'
Authorize.jwt_required()
Hello,
I am looking at migrating a Flask App (using to JWT Extended) tp FastApi and I could not find an equivalent to overwrite the key that is used.
I have a mulit-tenant Flask environment and I want a JWT token to only be valid for one tenant, so I add the tenant name to the secret key.
In JWT-extended I used the following function to overwrite the key that is used (and of course an equivalent decode function) def customEncodeKey(arg1): return app.config["JWT_SECRET_KEY"] + getTenant(request)
jwt.encode_key_loader(customEncodeKey)