# HG changeset patch # User Kim Alvefur # Date 1694422111 -7200 # Node ID d67980d9e12dfaf7ff8e917dbb7310822e7a9627 # Parent f16edebb130539c89ab7c1c1862bea4434294ca8 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. diff -r f16edebb1305 -r d67980d9e12d mod_http_oauth2/mod_http_oauth2.lua --- 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.