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:
@@ -351,15 +351,17 @@ func (api *API) listUserExternalAuths(rw http.ResponseWriter, r *http.Request) {
|
||||
if link.OAuthAccessToken != "" {
|
||||
cfg, ok := configs[link.ProviderID]
|
||||
if ok {
|
||||
newLink, valid, err := cfg.RefreshToken(ctx, api.Database, link)
|
||||
newLink, err := cfg.RefreshToken(ctx, api.Database, link)
|
||||
meta := db2sdk.ExternalAuthMeta{
|
||||
Authenticated: valid,
|
||||
Authenticated: err == nil,
|
||||
}
|
||||
if err != nil {
|
||||
meta.ValidateError = err.Error()
|
||||
}
|
||||
linkMeta[link.ProviderID] = meta
|
||||
|
||||
// Update the link if it was potentially refreshed.
|
||||
if err == nil && valid {
|
||||
if err == nil {
|
||||
links[i] = newLink
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user