flask-jwt
flask-jwt copied to clipboard
JWT (JSON Web Tokens) for Flask applications
from flask import Flask from flask_jwt import JWT, jwt_required, current_identity from werkzeug.security import safe_str_cmp class User(object): def **init**(self, id, username, password): self.id = id self.username = username self.password = password...
If the authentication handler returned a dictionary rather than an object then the default payload handler would throw an AttributeError as no default value was supplied for getattr().
It was throwing this error : ``` Traceback (most recent call last): File "/home/jobou/workspace/weenect-api/venv/lib/python3.4/site-packages/flask/app.py", line 1475, in full_dispatch_request rv = self.dispatch_request() File "/home/jobou/workspace/weenect-api/venv/lib/python3.4/site-packages/flask/app.py", line 1461, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File...
When using a dict object to represent an identity the default jwt_encode_callback handler fails as getattr does not work with dict objects. This change sets the default value of getattr...
Expired token would crash application if the config `JWT_VERIFY_EXPIRATION` set to `False` with default token decode handler Even when `JWT_VERIFY_EXPIRATION` is to `False`, the token would still be decode with...
https://github.com/mattupstate/flask-jwt/blob/master/flask_jwt/__init__.py#L113-L128 and https://github.com/mattupstate/flask-jwt/blob/master/flask_jwt/__init__.py#L182-L193 401 is Unauthorized 400 is Bad Request 401 Bad Request is not a thing. https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1 It looks like the default was changed in this [commit](https://github.com/mattupstate/flask-jwt/commit/2749d536015575a93f0d821aa0877275cf6a4a57) I'm not...
When the request is not JSON (and the `force` flag is False), Flask's [`get_json()`](https://github.com/mitsuhiko/flask/blob/0.10.1/flask/wrappers.py#L127) will return `None`. If somebody POSTs to `/auth` with a non-JSON mimetype, the server will 500...
authenticate and identity must be created and imported prior to jwt.init_app? is there a better way for application factory? ``` # auth_handlers.py @jwt.authentication_handler def authenticate(username, password): user = username_table.get(username, None)...
I write this issue [https://github.com/KarimJedda/connexion_jwt_example/issues/2](https://github.com/KarimJedda/connexion_jwt_example/issues/2) in the example using flask-jwt with Swagger api description. I see that writing parameters in swagger api.yaml file, and decorating the controller with @jwt_required() the...
As of 0.3.2, flask-jwt doesn't create a named auth endpoint (it is named `_default_auth_request_handler`). Given that JWT_AUTH_ENDPOINT option is in the docs, I created this PR to restore endpoint naming...