mirror of
https://github.com/coder/coder.git
synced 2026-09-22 05:05:20 +08:00
feat: keep original token refresh error in external auth (#19339)
External auth refresh errors lose the original error thrown on the first refresh. This PR saves that error to the database to be raised on subsequent refresh attempts
This commit is contained in:
@@ -40,13 +40,20 @@ UPDATE external_auth_links SET
|
||||
oauth_refresh_token = $6,
|
||||
oauth_refresh_token_key_id = $7,
|
||||
oauth_expiry = $8,
|
||||
oauth_extra = $9
|
||||
oauth_extra = $9,
|
||||
-- Only 'UpdateExternalAuthLinkRefreshToken' supports updating the oauth_refresh_failure_reason.
|
||||
-- Any updates to the external auth link, will be assumed to change the state and clear
|
||||
-- any cached errors.
|
||||
oauth_refresh_failure_reason = ''
|
||||
WHERE provider_id = $1 AND user_id = $2 RETURNING *;
|
||||
|
||||
-- name: UpdateExternalAuthLinkRefreshToken :exec
|
||||
UPDATE
|
||||
external_auth_links
|
||||
SET
|
||||
-- oauth_refresh_failure_reason can be set to cache the failure reason
|
||||
-- for subsequent refresh attempts.
|
||||
oauth_refresh_failure_reason = @oauth_refresh_failure_reason,
|
||||
oauth_refresh_token = @oauth_refresh_token,
|
||||
updated_at = @updated_at
|
||||
WHERE
|
||||
|
||||
Reference in New Issue
Block a user