pallets-eco / flask-jwt

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

make the default jwt_payload_handler work even if the identity has no 'id' attribute #79

Closed ntamas closed 8 years ago

ntamas commented 8 years ago

The default implementation of jwt_payload_handler fails if the identity object has no id attribute, even though it was clearly an intention to fall back to a dictionary lookup when such an attribute does not exist. The current implementation fails because getattr throws an AttributeError for missing attributes if no default value is provided. The patch fixes this by providing a default value of None for the attribute lookup, preventing the exception.

pall-valmundsson commented 8 years ago

Same as #63

ntamas commented 8 years ago

Closing this because of being a duplicate of #63.

eLvErDe commented 8 years ago

Hello,

I just ran into the same issue, please merge :)

Regards, Adam.