Questions tagged [flask-jwt-extended]

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.

143 questions
2
votes
2 answers

implementing flask_jwt_extended with templates rendering

Again fighting trying to make my first flask application, this time, (after I created every I need and all works smoothly) I'm trying to protect some endpoints with flask_jwt_extended, but I can't find how to work with them in my pages, the…
Green
  • 468
  • 5
  • 18
2
votes
2 answers

get_jwt_identity() returning None in Flask-JWT-Extended

I'm using Flask-JWT-Extended to protect my Flask API. After the Login, in the protected route (add-user), I call get_jwt_identity(), but it's returning None, so I'm not able to get the identity. @flask_app.route('//login',…
user994165
  • 9,146
  • 30
  • 98
  • 165
2
votes
1 answer

Propagate JWT Token between services

I'm looking to propagate a JWT token between my services running in docker using the library flask-jwt-extended and I have an idea of how I would do this using something similar to this: request.post(url, json={"access_token": access_token,…
jor2
  • 460
  • 2
  • 5
  • 21
2
votes
1 answer

flask-jwt-extended current_user identity = None when creating non-fresh access token from refresh token

In my flask app (python 2.7), I am trying to trigger the access token to refresh via the refresh token whenever it expires with the @jwt.expired_token_loader decorator. Both the access token and refresh token are stored in a cookie…
Danny Diaz
  • 375
  • 1
  • 4
  • 12
2
votes
0 answers

Authorization header passed from swagger doesnt get properly parsed missing Bearer

I have a blueprint defined in flask init.py from flask_restplus import Resource, Api from . import api_blueprint as _bp api = Api(_bp, prefix="/api") user_namespace = api.namespace("user", description="APi for User management") Then I am using…
Chang Zhao
  • 631
  • 2
  • 8
  • 24
2
votes
2 answers

Flask JWT Extended cookie name overide Flask Session Cookie Name

I am using the Flask JWT Extended extension for flask and have built a login application successfully using JWT. I have gone through the tutorial on JWT in Cookies on the JWT extended documentation site using CSRF protection and everything. What I…
1
vote
0 answers

Request.endpoint is none when bearer token is present

I have app where before request i check if JWT token is present in request. If the token is present I check for the user and if I get the user I want to redirect user to URL that he wanted to access if token isn't present redirect user to login…
rafaelHTML
  • 379
  • 1
  • 9
1
vote
1 answer

Flask JWT Extended Cookie Auth & WSGI raise 500 error instead of 401

I build a flask API for my purpose and want to integrate a JWT token auth via cookie. Everythings works well in my development environment. An unauthorized request answers with a 401 unauthorized. Below is an example endpoint. class…
1
vote
0 answers

unset_jwt_cookies not deleting cookies

Config app.config['JWT_COOKIE_CSRF_PROTECT'] = True app.config["JWT_TOKEN_LOCATION"] = ['cookies'] app.config["JWT_ACCESS_TOKEN_EXPIRES"] = timedelta(hours=0.005) class LogOut(Resource): @jwt_required() def get(self): response =…
private123
  • 11
  • 1
1
vote
0 answers

How to expire access token using flask-jwt-extend when new login is initiated

I am creating the access token using the flask-jwt-extended and storing it into httpcookie only. My requirement is if user logins to the site using credentials, I will generate one token and store it in httpcookie, so my protected route will be…
1
vote
0 answers

Where to store jwt token in flask app so that its picked up automatic jwt_required(optional=True)?

I was trying to create a flask app with user-login API call that generates access and refresh token and upon successful creation redirect back to homepage view which has jwt_required(optional=True) decorator but no matter how i try to save the token…
1
vote
0 answers

Is SECRET_KEY necessary for Flask apps that use JWTs?

I'm writing a Python 3.8 Flask app that uses the flask_jwt_extended library for authentication. In most vanilla Flask tutorials, I've seen app.config['SECRET_KEY] = [...] get set at runtime. Details on SECRET_KEY here. However, I'm now using…
hauslex
  • 36
  • 6
1
vote
2 answers

Missing Authorization Header in production only

I have the following work flow: I have a api/token [POST] that takes form-data (email and password) and returns and access token and a refresh token. Then I have another endpoint api/users/info [GET] (with Headers 'Authorization': 'Bearer ...) that…
39fredy
  • 1,923
  • 2
  • 21
  • 40
1
vote
1 answer

In flask-jwt-extended how to set a custom token expiry time?

In flask-jwt-entended package how can we set a custom token expiry time say for example 72 hours? I couldn't find any annotation of examples in the documentation link shared.
1
vote
0 answers

flask-blueprints - use decorator before function call with separated router and controller files

I came accross this syntax: users.route('/me', methods=["GET"])(get_user) when instead of the usual definition after the route, I can just specify its name after the route, and define it in another file. what about decorators? I'm using…
Benaya Trabelsi
  • 351
  • 3
  • 11