mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00: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:
@ -353,21 +353,16 @@ func (api *API) templateVersionExternalAuth(rw http.ResponseWriter, r *http.Requ
|
||||
return
|
||||
}
|
||||
|
||||
_, updated, err := config.RefreshToken(ctx, api.Database, authLink)
|
||||
if err != nil {
|
||||
_, err = config.RefreshToken(ctx, api.Database, authLink)
|
||||
if err != nil && !externalauth.IsInvalidTokenError(err) {
|
||||
httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{
|
||||
Message: "Failed to refresh external auth token.",
|
||||
Detail: err.Error(),
|
||||
})
|
||||
return
|
||||
}
|
||||
// If the token couldn't be validated, then we assume the user isn't
|
||||
// authenticated and return early.
|
||||
if !updated {
|
||||
providers = append(providers, provider)
|
||||
continue
|
||||
}
|
||||
provider.Authenticated = true
|
||||
|
||||
provider.Authenticated = err == nil
|
||||
providers = append(providers, provider)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user