session timeout

This commit is contained in:
simonredfern 2025-12-18 00:17:55 +01:00
parent 245893a33d
commit 498a509b2d
2 changed files with 14 additions and 0 deletions

View File

@ -26,6 +26,13 @@ VITE_OBP_OAUTH2_TOKEN_REFRESH_THRESHOLD=300
### Session Configuration (Optional) ###
# VITE_SESSION_MAX_AGE=3600 # Session timeout in seconds (default: 3600 = 1 hour)
# Common values:
# 1800 = 30 minutes
# 3600 = 1 hour (default)
# 7200 = 2 hours
# 14400 = 4 hours
# 28800 = 8 hours (full work day)
# 86400 = 24 hours
### Styling Configuration (Optional) ###
# VITE_OBP_LOGO_URL=https://example.com/logo.png # Custom logo image URL (uses default OBP logo if not set)

View File

@ -118,6 +118,13 @@ export class UserController {
session['oauth2_token_timestamp'] = Date.now()
session['oauth2_expires_in'] = newTokens.expiresIn
// CRITICAL: Update clientConfig with new access token
// This ensures subsequent API calls use the refreshed token
if (session['clientConfig'] && session['clientConfig'].oauth2) {
session['clientConfig'].oauth2.accessToken = newTokens.accessToken
console.log('UserController: Updated clientConfig with new access token')
}
console.log('UserController: Token refresh successful')
} catch (error) {
console.error('UserController: Token refresh failed:', error)