From b89f6abb69c8b24c7e3c4865652ed2bbd3d6a19d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Job=20Evers=E2=80=90Meltzer?= Date: Sat, 13 Feb 2016 21:48:20 -0700 Subject: [PATCH] Allow fallback to 'id' key --- flask_jwt/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flask_jwt/__init__.py b/flask_jwt/__init__.py index f864b78..dd5688b 100644 --- a/flask_jwt/__init__.py +++ b/flask_jwt/__init__.py @@ -50,7 +50,7 @@ def _default_jwt_payload_handler(identity): iat = datetime.utcnow() exp = iat + current_app.config.get('JWT_EXPIRATION_DELTA') nbf = iat + current_app.config.get('JWT_NOT_BEFORE_DELTA') - identity = getattr(identity, 'id') or identity['id'] + identity = getattr(identity, 'id', None) or identity['id'] return {'exp': exp, 'iat': iat, 'nbf': nbf, 'identity': identity}