# HG changeset patch # User bsw # Date 1597924898 -7200 # Node ID 6077545667ec1eb32c04abb6978db2bba2b51b51 # Parent 3fcae27c2709dff14d704694117c6ded9c055a47 Return remaining life time of tokens diff -r 3fcae27c2709 -r 6077545667ec app/main/oauth2/validate.lua --- a/app/main/oauth2/validate.lua Thu Aug 20 14:01:15 2020 +0200 +++ b/app/main/oauth2/validate.lua Thu Aug 20 14:01:38 2020 +0200 @@ -45,6 +45,10 @@ local r = json.object() r.scope = scope + +local expiry = db:query({ "SELECT FLOOR(EXTRACT(EPOCH FROM ? - now())) AS access_time_left", token.expiry }, "object") +r.expires_in = expiry.access_time_left + r.member_id = token.member_id if token.member.role then r.member_is_role = true