Skip to content

Commit 4a85612

Browse files
committed
session timeout
1 parent a70b352 commit 4a85612

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

ai_env.example

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ VITE_OBP_OAUTH2_TOKEN_REFRESH_THRESHOLD=300
2626

2727
### Session Configuration (Optional) ###
2828
# VITE_SESSION_MAX_AGE=3600 # Session timeout in seconds (default: 3600 = 1 hour)
29+
# Common values:
30+
# 1800 = 30 minutes
31+
# 3600 = 1 hour (default)
32+
# 7200 = 2 hours
33+
# 14400 = 4 hours
34+
# 28800 = 8 hours (full work day)
35+
# 86400 = 24 hours
2936

3037
### Styling Configuration (Optional) ###
3138
# VITE_OBP_LOGO_URL=https://example.com/logo.png # Custom logo image URL (uses default OBP logo if not set)

server/controllers/UserController.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ export class UserController {
118118
session['oauth2_token_timestamp'] = Date.now()
119119
session['oauth2_expires_in'] = newTokens.expiresIn
120120

121+
// CRITICAL: Update clientConfig with new access token
122+
// This ensures subsequent API calls use the refreshed token
123+
if (session['clientConfig'] && session['clientConfig'].oauth2) {
124+
session['clientConfig'].oauth2.accessToken = newTokens.accessToken
125+
console.log('UserController: Updated clientConfig with new access token')
126+
}
127+
121128
console.log('UserController: Token refresh successful')
122129
} catch (error) {
123130
console.error('UserController: Token refresh failed:', error)

0 commit comments

Comments
 (0)