[refresh-token] add refresh token endpoint

typo

[refresh-token] Refactor renew token stuff, add jwt_get_user_id_from_payload_handler for custom user_id format

[refresh-token] add tests for refresh token feature

some more api checks
Merge 0fa570907b2cde39231355f191c8b264c417b724 into 3554790352473669a987c8282cf7a637316227e0
Fix some errors with Python2.6 and Python3

For Python2.6: fix non-existing total_seconds by converting datetime
delta to seconds.

For Python3: fix "datetime is not JSON serializable" issue by converting
the delta datetime to unix timestamp first.