Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
chore: return failed refresh errors on external auth
Failed refreshes should return errors. These errors are captured
as validate errors. A fair classification of the the error
  • Loading branch information
Emyrk committed May 29, 2024
commit f5d5dcd49df23c6338c22fa9148544c2ee47ab09
8 changes: 5 additions & 3 deletions coderd/externalauth/externalauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,11 @@ func (c *Config) RefreshToken(ctx context.Context, db database.Store, externalAu
Expiry: externalAuthLink.OAuthExpiry,
}).Token()
if err != nil {
// Even if the token fails to be obtained, we still return false because
// we aren't trying to surface an error, we're just trying to obtain a valid token.
return externalAuthLink, false, nil
// TokenSource will always return the current status token if not-expired.
// If the token is expired, it will attempt to refresh. An error is returned
// if the refresh fails, meaning the existing token is expired and this function
// was unable to obtain a valid one.
return externalAuthLink, false, err
}

extra, err := c.GenerateTokenExtra(token)
Expand Down