OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

jwt.exceptions.DecodeError: Invalid crypto padding {"msg":"Invalid crypto padding"}

  • Thread starter Thread starter Anatoliy
  • Start date Start date
A

Anatoliy

Guest
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 request it response {"msg":"Invalid crypto padding"}

Code:
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 everythind what i found on stackoverflow and other sites, but it does not work. Also i tried to reinstall flask_jwt_extended but it does not help too
<p>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 request it response {"msg":"Invalid crypto padding"}</p>
<pre><code>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()
</code></pre>
<p>I tried everythind what i found on stackoverflow and other sites, but it does not work. Also i tried to reinstall flask_jwt_extended but it does not help too</p>
 

Latest posts

Top