Software /
code /
prosody-modules
Diff
mod_http_oauth2/mod_http_oauth2.lua @ 5669:d67980d9e12d
mod_http_oauth2: Apply refresh token ttl to refresh token instead of grant
The intent in 59d5fc50f602 was for refresh tokens to extend the lifetime
of the grant, but the refresh token ttl was applied to the grant and
mod_tokenauth does not change it, leading to the grant expiring
regardless of refresh token usage.
This makes grant lifetimes unlimited, which seems to be standard
practice in the wild.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 11 Sep 2023 10:48:31 +0200 |
parent | 5666:73c3d5bfce3e |
child | 5688:bbde136a4c29 |
line wrap: on
line diff
--- a/mod_http_oauth2/mod_http_oauth2.lua Mon Sep 11 10:19:38 2023 +0200 +++ b/mod_http_oauth2/mod_http_oauth2.lua Mon Sep 11 10:48:31 2023 +0200 @@ -272,7 +272,7 @@ local grant = refresh_token_info and refresh_token_info.grant; if not grant then -- No existing grant, create one - grant = tokens.create_grant(token_jid, token_jid, default_refresh_ttl, token_data); + grant = tokens.create_grant(token_jid, token_jid, nil, token_data); end if refresh_token_info then @@ -284,7 +284,7 @@ end end -- in with the new refresh token - local refresh_token = refresh_token_info ~= false and tokens.create_token(token_jid, grant.id, nil, nil, "oauth2-refresh"); + local refresh_token = refresh_token_info ~= false and tokens.create_token(token_jid, grant.id, nil, default_refresh_ttl, "oauth2-refresh"); if role == "xmpp" then -- Special scope meaning the users default role.