Questions tagged [flask-jwt]

JWT (JSON Web Tokens) for Flask applications. MIT-licensed.

71 questions
29
votes
1 answer

Using Flask-Security Roles with Flask-JWT REST API

I am building a Flask-based REST API and using Flask-JWT to handle JWT auth. I also want to use the built in roles management with Flask-Security. However, Flask-Security's @roles_required() decorator assumes I am showing a Flask view when it…
chrcoe
  • 412
  • 4
  • 13
28
votes
3 answers

Flask-restful API Authorization. Access current_identity inside decorator

I use flask-restful to create my APIs. I have used flask-jwt for enabling authentication based on JWT. Now I need to do authorization. I have tried putting my authorization decorator. test.py (/test api) from flask_restful import Resource from…
Hussain
  • 5,057
  • 6
  • 45
  • 71
15
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
  • 12,243
  • 18
  • 88
  • 130
13
votes
1 answer

Internal Redirect in Flask

In short: By only using the Flask micro-framework (and its dependencies) can we perform an internal redirect from one route to another? For example: User submits the registration form (both username and password) to @app.route('/register',…
grim
  • 6,669
  • 11
  • 38
  • 57
12
votes
2 answers

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
  • 468
  • 5
  • 18
8
votes
1 answer

TypeError: wrapper() got an unexpected keyword argument 'nam' while using @jwt_required

app.py from flask import Flask,request from flask_restful import Api , Resource from flask_jwt import JWT ,jwt_required , current_identity from security import auntheticate , identity app = Flask(__name__) app.secret_key = "sangam" api =…
ChangeAdopter
  • 81
  • 1
  • 2
8
votes
1 answer

Manually validate flask-extended-jwt's access token

I have a SPA app that contains an form with an upload file field. I have a rest API whose endpoints are protected via flask-extended-jwt JWT. To authenticate the REST endpoints I use @jwt_required. I want to authenticate the upload request as…
florin
  • 719
  • 12
  • 31
8
votes
2 answers

Using flask_login and flask-JWT together in a REST API

I am new to flask, recently learned about flask_security/flask_login/flask_user. I wish that somehow I could use flask_login along with flask-JWT, for the REST API. Basically, I'd like to have the features like remember-me, forgot-password etc,…
penka_the_cow
  • 81
  • 1
  • 4
8
votes
4 answers

On logout invalidate flask-JWT

I have generated Flask-JWT token for user authentication, but on logout i want to invalidate token. Now it's allowing to access route after logout. @app.route('/logout', methods=['POST']) @jwt_required def logout(): user = current_user …
Mayur Patil
  • 95
  • 1
  • 2
  • 9
5
votes
1 answer

Bad Request when posting JSON to Flask endpoint in unit test

I found a load of questions about people trying to post JSON to a Flask app, but none of those are quite the problem I have here. I have a simple REST API, built using Flask and Flask-JWT, which is working fine through a browser, but I've hit a…
tx802
  • 3,524
  • 2
  • 17
  • 22
5
votes
1 answer

flask-jwt How handle a token?

I'm new using JWT and flask-jwt so I run the example where I find in docs. I read this to get a better understanding of JWT. But now I wonder how I should handle more than one token? I mean, a user post his credentials to "myserver/auth" and then…
Ricardo
  • 7,921
  • 14
  • 64
  • 111
4
votes
1 answer

Flask JWT Token/ Payload - Return User Json

I understand that Flask JWT gives us the /auth endpoint. Once a user successfully logs in, an access token is assigned and the logged in user can be stored in Flask JWT's current_identity. What I'm wondering is can I also return the User Json back…
user7804097
  • 308
  • 1
  • 3
  • 17
3
votes
1 answer

Flask-jwt error with Flask-restful if request contain JSON

I am developing a RESTful API using Flask-restful and Flask-jwt. When I use @jwt_required() for any endpoint and I send a request containing JSON data, I do not get the error message JSON I specify. If I remove the JSON data, the request is handled…
Mohamed_AbdAllah
  • 5,311
  • 3
  • 28
  • 47
3
votes
1 answer

Authentication with Vue.js | Flask-RESTful and Google Sign-In

I am still a newcomer to both the Vue.js as well as the Flask framework. I have created a simple todo app that consumes JSON endpoints from Flask and uses Vue.js to display the UI. My app has a TODO, PROJECT and USER model. I have successfully…
3
votes
1 answer

Combining Flask Blueprints with Flask-JWT

I am developing a Flask 0.12 app with Blueprints and I am trying to use Flask-JWT (0.3.2) for authentication. None of the tutorials that I can see for Flask-JWT use Blueprints. There is a usually a block of code in each example, that does something…
ChrisGuest
  • 3,398
  • 4
  • 32
  • 53
1
2 3 4 5