mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: return failed refresh errors on external auth as string (was boolean) (#13402)
* chore: return failed refresh errors on external auth Failed refreshes should return errors. These errors are captured as validate errors.
This commit is contained in:
@@ -559,16 +559,17 @@ func (s *server) acquireProtoJob(ctx context.Context, job database.ProvisionerJo
|
||||
continue
|
||||
}
|
||||
|
||||
link, valid, err := config.RefreshToken(ctx, s.Database, link)
|
||||
if err != nil {
|
||||
refreshed, err := config.RefreshToken(ctx, s.Database, link)
|
||||
if err != nil && !externalauth.IsInvalidTokenError(err) {
|
||||
return nil, failJob(fmt.Sprintf("refresh external auth link %q: %s", p.ID, err))
|
||||
}
|
||||
if !valid {
|
||||
if err != nil {
|
||||
// Invalid tokens are skipped
|
||||
continue
|
||||
}
|
||||
externalAuthProviders = append(externalAuthProviders, &sdkproto.ExternalAuthProvider{
|
||||
Id: p.ID,
|
||||
AccessToken: link.OAuthAccessToken,
|
||||
AccessToken: refreshed.OAuthAccessToken,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user