Reputation: 11
I am testing my API but there is an error.
When I use decode_token()
, it works correctly, but when I try to pass a token through a request, it responds {"msg":"Invalid crypto padding"}
import requests
from flask import Flask
from flask_jwt_extended import create_access_token, JWTManager, decode_token, jwt_required
from __init__ import app
#app = Flask(__name__)
#app.config["JWT_SECRET_KEY"] = "test"
jwt = JWTManager(app)
context = app.app_context()
def test():
with context:
access_token =create_access_token(identity="Testmerch")
print(access_token)
print(decode_token(access_token))
headers1 = {
'Authorization' : f'Bearer <{access_token}>'
}
print(headers1)
r = requests.get("http://127.0.0.1:5000/api/v1/statistics/merchant/all/", headers=headers1)
print(r.text)
test()
I tried everything I found on stackoverflow, and other websites, but it did not work. Also, I tried to reinstall flask_jwt_extended
but it did not help either.
Upvotes: 1
Views: 127