pallets-eco / flask-jwt

JWT (JSON Web Tokens) for Flask applications
MIT License
564 stars 177 forks source link

Fix AttributeError on identity #84

Closed dokime7 closed 8 years ago

dokime7 commented 8 years ago

When the user object returned by the authentication_handler is a dict, this exception is raised: File "/usr/local/lib/python2.7/dist-packages/flask_jwt/init.py", line 53, in _default_jwt_payload_handler identity = getattr(identity, 'id') or identity['id'] AttributeError: 'dict' object has no attribute 'id' So getattr must not raise an exception but return None in order to evaluate the second par of the if: identity['id']

dokime7 commented 8 years ago

Sorry, this is a dupplicate of #78

coveralls commented 8 years ago

Coverage Status

Coverage remained the same at 95.652% when pulling 17b81b4dfa6dcdfef05aa68deacb7aeaaa33d3fb on dokime7:patch-1 into c27084114e258863b82753fc574a362cd6c62fcd on mattupstate:master.