Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name 'jwt_refresh_token_required' from 'flask_jwt_extended' #47

Open
harshrpatel opened this issue Feb 16, 2021 · 8 comments

Comments

@harshrpatel
Copy link

Having this error as soon as I cloned the project and tried installation steps, can someone help me set this up?

here's my pip freeze :

alembic==1.5.4 aniso8601==8.1.1 apispec==4.3.0 apispec-webframeworks==0.5.2 appdirs==1.4.4 arrow==0.17.0 binaryornot==0.4.4 certifi==2020.12.5 chardet==4.0.0 click==7.1.2 cookiecutter==1.7.2 distlib==0.3.1 filelock==3.0.12 Flask==1.1.2 Flask-JWT-Extended==4.0.2 flask-marshmallow==0.14.0 Flask-Migrate==2.6.0 Flask-RESTful==0.3.8 Flask-SQLAlchemy==2.4.4 gunicorn==20.0.4 idna==2.10 itsdangerous==1.1.0 Jinja2==2.11.3 jinja2-time==0.2.0 Mako==1.1.4 MarkupSafe==1.1.1 marshmallow==3.10.0 marshmallow-sqlalchemy==0.24.2 packaging==20.9 passlib==1.7.4 pluggy==0.13.1 poyo==0.5.0 py==1.10.0 PyJWT==2.0.1 pyparsing==2.4.7 python-dateutil==2.8.1 python-dotenv==0.15.0 python-editor==1.0.4 python-slugify==4.0.1 pytz==2021.1 PyYAML==5.4.1 requests==2.25.1 six==1.15.0 SQLAlchemy==1.3.23 text-unidecode==1.3 toml==0.10.2 tox==3.22.0 urllib3==1.26.3 virtualenv==20.4.2 Werkzeug==1.0.1

@bitjockey42
Copy link

Looks like there were breaking changes for flask-jwt-extended 4.0.2.

auth/views.py calls some functions that no longer exist, were deprecated, or were replaced in v4 of flask-jwt-extended.

I was able to fix it by updating the imports and changing some calls: https://gist.github.com/bitjockey42/4921deadd3f57ec248796b83495baf54

Hope that helps.

@hpardora
Copy link

hpardora commented Feb 27, 2021

Hi @bitjockey42 , I saw your fix, but im getting the following error when calling a blueprint endpoint, F.E: /api/v1/users
It result into a 500 with the following log: TypeError: wrapper() missing 1 required positional argument: 'fn'
Did you already fixed this error by your own, or it only happen to me ?
thx!

alembic==1.5.5
aniso8601==9.0.0
apispec==4.3.0
apispec-webframeworks==0.5.2
appdirs==1.4.4
click==7.1.2
distlib==0.3.1
filelock==3.0.12
Flask==1.1.2
Flask-JWT-Extended==4.0.2
flask-marshmallow==0.14.0
Flask-Migrate==2.7.0
Flask-RESTful==0.3.8
Flask-SQLAlchemy==2.4.4
gunicorn==20.0.4
itsdangerous==1.1.0
Jinja2==2.11.3
Mako==1.1.4
MarkupSafe==1.1.1
marshmallow==3.10.0
marshmallow-sqlalchemy==0.24.2
packaging==20.9
passlib==1.7.4
pluggy==0.13.1
py==1.10.0
PyJWT==2.0.1
pyparsing==2.4.7
python-dateutil==2.8.1
python-dotenv==0.15.0
python-editor==1.0.4
pytz==2021.1
PyYAML==5.4.1
six==1.15.0
SQLAlchemy==1.3.23
toml==0.10.2
tox==3.22.0
virtualenv==20.4.2
Werkzeug==1.0.1

@karec
Copy link
Owner

karec commented Mar 1, 2021

Hello @hpardora and @bitjockey42 and sorry for taking so long to answer.

As @bitjockey42 pointed out, those issues are related to breaking changes introduced in flask-jwt-extended. I'm currently working on a fix and I will do my best to release it ASAP.

@hpardora if that can help you, the issue you encounter right now is linked to those API changes and you'll need to replace

@jwt_required

with

@jwt_required()

@karec
Copy link
Owner

karec commented Mar 1, 2021

@hpardora @bitjockey42 issue should be solved with commit f1e9a29, build is passing now

@hpardora
Copy link

hpardora commented Mar 1, 2021

@karec thx! i will try later.

@bitjockey42
Copy link

@karec Tried the template again and your fix in that commit worked! Thank you

@karec
Copy link
Owner

karec commented Mar 15, 2021

@bitjockey42 thanks for the feedback, I'll close this issue, don't hesitate to re-open it if you still have issues with the flask_jwt_extended upgrade

@karec karec closed this as completed Mar 15, 2021
@karec
Copy link
Owner

karec commented Dec 1, 2021

Hello @alexanderdamiani

This is due to a breaking change in flask_jwt_extended itself, see here for more details.

In this cookiecutter I've upgraded imports to match those breaking changes, do you still have issues with the cookiecutter ? if yes could you point me to the file that cause error ?

@karec karec reopened this Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants