flask-jwt icon indicating copy to clipboard operation
flask-jwt copied to clipboard

bugfix for dict based identity

Open pall-valmundsson opened this issue 9 years ago • 8 comments

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 to None so the dict get part of the statement is evaluated.

The tests required a different implementation of the app fixture.

pall-valmundsson avatar Nov 12 '15 20:11 pall-valmundsson

Please merge this :+1:

garykrige avatar Jan 13 '16 13:01 garykrige

:+1:

davidrpmorris avatar Feb 27 '16 18:02 davidrpmorris

:+1: (same as my pull request #79 - I did not notice this one).

ntamas avatar Mar 13 '16 19:03 ntamas

I have run into the same error when retrieving identity from RethinkDB, which return in dict.

I would create my own PR if I did not find this PR.

by the way, how about make it this way

identity = getattr(identity, 'id', None) or identity.get('id', None)

feel more robust

Wish it being merged soon.

aguegu avatar Mar 30 '16 03:03 aguegu

Hello,

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

Regards, Adam.

eLvErDe avatar Jun 06 '16 13:06 eLvErDe

@mattupstate this is a fairly urgent and easy bug to fix

garykrige avatar Jun 07 '16 09:06 garykrige

@mattupstate this issue still not fixed, please merge

setyongr avatar Jul 17 '16 10:07 setyongr

I don't intend to maintain the fork but in the meantime, I merged several nice PRs and fixes into https://github.com/webstack/flask-jwt/commits/fork

stephane avatar Aug 03 '16 21:08 stephane