Skip to content

Commit 3618ef2

Browse files
committed
Use tok.Valid() for OAuth token validity check
Replace manual expiry check with tok.Valid() which properly handles nil tokens, empty access tokens, and expiry in a single call.
1 parent 4548ef6 commit 3618ef2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

oauth/oauth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func GetClient(ctx context.Context, config *oauth2.Config, tokenPath string) (*h
8989
//nolint:nestif
9090
if err == nil {
9191
// we have a token, but it has expired so attempt to refresh it
92-
if tok.Expiry.Before(time.Now()) {
92+
if !tok.Valid() {
9393
src := config.TokenSource(ctx, tok)
9494

9595
// refresh token

0 commit comments

Comments
 (0)