Flask-JWT-Extended is an opinionated Flask extension that adds support for using JSON Web Tokens (JWT) to protect views. It also many helpful (and optional) features built in to make working with JSON Web Tokens easier.
Questions tagged [flask-jwt-extended]
111 questions
0
votes
0 answers
Flask object has no attribute jwt_manager
i'm trying to implement unit test with unittest library and i'm having some problems.
I have my test skeleton as folowing:
class TestSetup(unittest.TestCase):
############################
#### setup and teardown ####
…
Alvaro Pani
- 9
- 4
0
votes
1 answer
How to choose which decorator to apply based on condition?
Can decorators be applied based on condition ? Below is a trivial example:
import os
def bold_decorator(fn):
def wrapper(*args, **kwargs):
return '**' + fn(*args, **kwargs) + '**'
return wrapper
def italic_decorator(fn):
def…
Dinko Pehar
- 3,766
- 3
- 14
- 34
0
votes
2 answers
Cookies not stored with React native and Flask/ Flask jwt-extended
I am using Flask and flask-jwt-extended in order to do the authentication on my server.
When I use Postman, all my cookies are setup correctly. However, when I use a browser and react-native, none of the cookies are stored.
Environment:
Flask…
Abilys38
- 303
- 4
- 16
0
votes
1 answer
How to set the 'iss' claim of JWT using Flask-JWT-Extended's create_access_token()
Is there a way to set the iss claim of the JWT that is generated by create_access_token of Flask-JWT-Extended?
I tried to put the iss claim under the parameter 'user_claims' of the create_access_token:
access_token = create_access_token(
…
Paul
- 245
- 2
- 10
0
votes
1 answer
flask-jwt-extended. POST requests fail when JWT_COOKIE_CSRF_PROTECT=True
I'm using flask-jwt-extended to protect a rest api using JWT cookies.
I have found that when
app.config['JWT_COOKIE_CSRF_PROTECT'] = True
POST requests to protected endpoints don't work (while GET's do).
Here is my setup.
#app.py
app =…
anonthot
- 1
0
votes
0 answers
how to verify users using twilio while I'm using jwt extended in flask?
I have an app that using flask jwt extended along with sqlalchemy and I need to verify users by twilio, how can I do that ?
Mahmoud Gamal
- 11
- 2
0
votes
3 answers
How can I make sure a JWT doesn't expire on the user
So I'm able to create aa JWT on login using flask-jwt-extended
I set the expiration to 5 minutes.
So I have routes in my VueJS app and when they are called(beforeeach) I make a call to "/api/check" to make sure that the token is valid.
All other API…
BostonMacOSX
- 1,057
- 2
- 14
- 29
0
votes
0 answers
How to make a GET request on a protected route with httpOnly cookie? (Flask REST Api with JWT)
I try to rebuild my API with using httpOnly tokens:
This is my Login endpoint:
@api.route("/login")
class UserLogin(Resource):
def post(self):
data = dict(login=True)
resp = make_response(jsonify(**data), 200)
…
Data Mastery
- 550
- 6
- 18
0
votes
1 answer
Flask JWT Extended returned identity as id instead of email
My Flask app i made is using flask-jwt-extended for JWT auth. As i followed this tutorial, i added email as indentity when created access token right here:
class ApiLogin(Resource):
def post(self):
data = loginParser.parse_args()
…
Vicky Sultan
- 55
- 9
0
votes
0 answers
Manage User Sessions with same token in flask jwt extended
I am building a REST API Flask App in python3.
I am not able to handle a scenario where
User A is generating a Token by his/her username/password .
Token has expiry of 1 day / 24 hrs.
Then he transferred/given the JWT token to user B and user B has…
0
votes
1 answer
How can I add Authorization header to a request so that a flask route with @jwt_required can be access if access token is present on the headers
I'm trying to implement flask_jwt_extended to my flask app.
My Use Case is, I want to set Authorization headers to every request. So that when a @jwt_required decorator is decorated to a flask route it can be access if an access token is present on…
Emman Lopez Telewik
- 133
- 3
- 11
0
votes
0 answers
API support for both public and loggedin user in Flask_JWT_Extended
In my app, I have a search feature where both public user and loggedin user can use. However, the outcome would be different. I am using following code for defining the API
@app.route('/search', methods=['GET', 'POST'])
def Search():
if…
C M Khaled Saifullah
- 144
- 2
- 12
0
votes
3 answers
Store tokens in browser cookies with Flask jwt extended
I know how to create tokens with this library, and also how to put tokens in reponse body:
access_token = create_access_token(identity = token_identity)
refresh_token = create_refresh_token(identity = token_identity)
set_access_cookies({"login":…
Abilys38
- 303
- 4
- 16
0
votes
1 answer
How to use jwt refresh tokens
I am working with python flask_jwt_extended to handle jwt. I have a refresh endpoint (from the docs) as follows:
# The jwt_refresh_token_required decorator insures a valid refresh
# token is present in the request before calling this endpoint. We
#…
msche
- 66
- 7
0
votes
1 answer
Send post request with flask_jwt_extended
I am trying to send a post request to a Flask server that uses flask_jwt_extended tokens. I don’t want the page to refresh after each submit and I managed to do this using jquery. But I am unable to send CSRF token in a way that flask_jwt_extended…
msche
- 66
- 7