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
1
vote
1 answer

storing and sending jwt httponly cookie, and csrf token with postman

I have a flask API, with jwt authentication, on a httponly cookie. I installed interceptor, added the domain(with HTTPS) to the list, and enabled the requests and cookies interception. but still, how do I make postman send the cookie I got from…
1
vote
1 answer

Flask JWT Extended- Different locations for access_token (header) & refresh_token(httpOnly cookie)

How to configure flask app with flask-jwt-extended for which we need something like below. AccessToken/Bearer must sent as a Header (and not cookie) RefreshToken must sent as httpOnlyCookie for /api/refreshtoken path only How to set two different…
Raxit Sheth
  • 2,491
  • 5
  • 17
  • 20
1
vote
1 answer

Is it possible to send JWT tokens if front-end is hosted on one domain, and back-end on another one?

I have a full-stack application divided into 2 apps: front-end and backend. The front-end is React app running under web dev server. The back-end is Flask app working as Restful API. I implemented JWT on back-end and wonder if I can store JWT access…
mimic
  • 4,897
  • 7
  • 54
  • 93
1
vote
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
  • 11
  • 1
1
vote
2 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":…
user10800954
1
vote
0 answers

Efficient way to get a token in flask

What is the difference between get_jwt_identity and verify_jwt_in_request_optional ? Which one is an efficient way to get the token from the API?
1
vote
0 answers

Request randomly hangs when making an API call

I have a stack of Flask, Nginx, Gunicorn deployed on AWS. There are a set of API routes present on it, and when I try to make requests to the /api/login path, the Postman request hangs randomly. At this point, I do not see any change in nginx error…
1
vote
1 answer

Flask-JWT-Extended: @jwt_refresh_token_required annotation does not work

I have a login resource (/login endpoint), following Oleg Agapov's tutorial: class UserLogin(Resource): def post(self): data = parser.parse_args() current_user = User.find_by_email(data['email']) if not current_user: …
1
vote
0 answers

Flask JWT Extension throws exception when validating a Google JWT token

I have a SPA application. Each client request contains an Authorization: Bearer retrieved from google https://developers.google.com/identity/protocols/OpenIDConnect (google creates the JWT token) When authenticating endpoints (graphQL…
1
vote
1 answer

How can I set a persistent JWT token header in flask?

I can't seem to find a way to set the JWT Token as a header in each HTTP Request without the help of Javascript. Currently I have my application setup to use the methods 'set_access_cookies' and 'unset_access_cookies' to keep track of the session.…
BlackAperture
  • 69
  • 1
  • 8
1
vote
1 answer

flask-jwt-extended - Catch raise RevokedTokenError('Token has been revoked')

I already tried reading the documents as well try out the changing default behaviors https://flask-jwt-extended.readthedocs.io/en/latest/changing_default_behavior.html to handle the error (the link shows how to handle expired token) and search…
Mheruian
  • 143
  • 1
  • 8
1
vote
1 answer

Authentication login Cookies not being set in browser - Flask backend API + Angular 7 frontend

I'm building a webapplication using a Flask backend api with an Angular frontend. The API runs on http://localhost:5000, the frontend on http://localhost:4200. For some reason cookies are not being set in the browser. The browser headers seem to be…
1
vote
1 answer

How to set browser cookie from curl request

After lot of head banging and lot of waste of time, I have learned that if I use curl to test storing of token into cookie as shown on flask_jwt_extended website the cookie does not get set but if I use the RESTClient in the browser the cookie does…
Ciasto piekarz
  • 7,853
  • 18
  • 101
  • 197
1
vote
1 answer

store jwt token into cookie in python flask restplust for login api

I have written REST API for login and logout using flask-restplus and flask_jwt_extended, I implemented jwt access_token generation that works seamlessly, but now I need to store token into cookie. my code is like this: api/user/resource.py from…
Chang Zhao
  • 631
  • 2
  • 8
  • 24
1
vote
1 answer

jwt python can´t add token to user

i´m doing a simple project where I want to add jwt authentication. When I log in I try to create a new token but when i´m trying to see who´s the user using the token it says that the token is missing. I´m using Flask and SQLAlchemy with…
Ricardo Pinto
  • 333
  • 1
  • 2
  • 11