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.

111 questions
12
votes
5 answers

flask-jwt-extended: Fake Authorization Header during testing (pytest)

This is the function I wish to test @jwt_required def get_all_projects(self): # implementation not included here I call the function from a pytest class def test_get_all_projects(db_session): all_projects =…
Hanxue
  • 10,413
  • 12
  • 81
  • 120
9
votes
1 answer

Flask JWT extend validity of token on each request

Scenario A logged in user will have a token expiry of 24 hours. Within that period, all request with @jwt_required decorator will have the current access token's expiry extended by another 24 hours. There is a maximum validity of 168(24 * 7) hours.…
Hanxue
  • 10,413
  • 12
  • 81
  • 120
8
votes
1 answer

TypeError: Object of type function is not JSON serializable when using flask_jwt_extended int RESTful API

I'm building a REST API using flask. I'm using postman for testing a route that creates a new item in my database, but only if the user is logged in. The routes for registering and login are working well, the last one returns the token using…
7
votes
2 answers

How to POST the refresh token to Flask JWT Extended?

I am trying to refresh a JWT token from the code here. The issue is with how to get the new token with the refresh. This works: curl http://127.0.0.1:5000/protected {"msg":"Missing Authorization Header"} This works and I get my token and put it in…
Johnny John Boy
  • 2,022
  • 4
  • 13
  • 36
6
votes
1 answer

is there a difference between flask-jwt and flask-jwt-extended?

I just learned about flask and JWT like a week ago so I could really use some help. Can someone explain the difference between flask-jwt and flask-jwt-extended?
Green
  • 346
  • 3
  • 15
6
votes
1 answer

Use JWT Token created by Python in Java

I have a interesting question. I use python with Flask for a authentication service, which generates JWT Tokens with flask_jwt_extended. Thats how I generate the tokens in Python, with Flask JWT Extended. identity = { "firstname":…
ghovat
  • 945
  • 8
  • 32
5
votes
1 answer

How to hold Plotly dash app behind protected route

I have a plotly dash app which I would like to hold behind a route that is protected with a JWT. My end goal is to contain this in an iframe on a separate route, but I only want the user to be able to get the html of th dash app if they have an…
5
votes
2 answers

flask_jwt_extended is throwing an error decoding my JWT. How can I capture it?

I'm having issues trying to capture a malformed JWT error in my app. I'm using flask_jwt_extended and when I send a manually created JWT. I get this error message: Error on request: Traceback (most recent call last): File…
NotMe
  • 615
  • 2
  • 5
  • 21
5
votes
2 answers

Using flask-jwt-extended callbacks with flask-restful and create_app

I'm trying to create API tokens for my flask API with flask-jwt-extended. I'm trying to initialize the token_in_blacklist_loader but can't figure out the right way to do that. The problem is that token_in_blacklist_loader is implemented as a…
Daniel Kats
  • 4,055
  • 10
  • 47
  • 88
4
votes
1 answer

Cookies are not stored properly in ios simulator

I am using Flask, flask-jwt-extended, and React-native (with Expo) for a mobile application. When I use web-browser simulation or Postman, all my cookies are setup correctly. However, when I use the ios simulator from Xcode, none of the cookies are…
Abilys38
  • 303
  • 4
  • 16
4
votes
1 answer

Flask-Limiter does not work with Flask-Restful API-based application

I am trying to build a RESTful API app with flask_restful, flask_jwt_extended for user authorization and flask_limiter to limit the quota of a user at 6/minute. My toy/testing code follows (no actual authorization schemes have been implemented…
4
votes
2 answers

How can I do custom JWT validation with Flask and flask_jwt_extended?

I want to add additional verification to the token when @jwt_required is called. I want to verify one of the claims. Is there away I can do this with JWTManager? Currently my code just calls: jwt = JWTManager(app) And I decorate the functions with:…
James MV
  • 8,145
  • 14
  • 61
  • 87
3
votes
1 answer

POST requests not working with token validation checks

With flask_jwt_extended, whenever I'm trying to send a POST request with the following decorators: @jwt_refresh_token_required @jwt_required I am having this 401 error: { "msg": "Missing CSRF token" } When I use a GET instead, it's working…
Abilys38
  • 303
  • 4
  • 16
3
votes
1 answer

How can I get the current user(id) in flask-jwt-extended?

I am new to python/flask and I am working on one to many relationships. I tried some solutions but didn't work. My problem here is in the "/add_about" route I want to get the user_id that created this post and be able to see that reflected in the…
3
votes
3 answers

How to fake JWT Authorization outside of request context and get current identity?

I'm creating a Flask app with JWT Authorization and trying to test services with PyTest. I successfully added tests to endpoints, but when I trying to add unit tests for certain function I can't access current user, because…
ShaVas
  • 31
  • 5
1
2 3 4 5 6 7 8