From 030e870788f32db4cd7da0bb620b83cf39e547ed Mon Sep 17 00:00:00 2001 From: Vicente Ruiz Date: Sun, 10 Jul 2016 09:55:10 +0200 Subject: [PATCH] Update __init__.py --- 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}