File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,10 @@ type Config struct {
1414
1515// RefreshingConfig refreshing token config
1616type RefreshingConfig struct {
17+ // access token expiration time
18+ AccessTokenExp time.Duration
19+ // refresh token expiration time
20+ RefreshTokenExp time.Duration
1721 // whether to generate the refreshing token
1822 IsGenerateRefresh bool
1923 // whether to reset the refreshing create time
Original file line number Diff line number Diff line change @@ -373,6 +373,14 @@ func (m *Manager) RefreshAccessToken(tgr *oauth2.TokenGenerateRequest) (accessTo
373373 ti .SetAccess (tv )
374374 ti .SetAccessCreateAt (td .CreateAt )
375375
376+ if v := rcfg .AccessTokenExp ; v > 0 {
377+ ti .SetAccessExpiresIn (v )
378+ }
379+
380+ if v := rcfg .RefreshTokenExp ; v > 0 {
381+ ti .SetRefreshExpiresIn (v )
382+ }
383+
376384 if rcfg .IsResetRefreshTime {
377385 ti .SetRefreshCreateAt (td .CreateAt )
378386 }
You can’t perform that action at this time.
0 commit comments