mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
fix: remove refresh oauth logic on OIDC login (#8950)
* fix: do not do oauth refresh logic on oidc login
This commit is contained in:
@ -1427,7 +1427,8 @@ func (api *API) oauthLogin(r *http.Request, params *oauthLoginParams) ([]*http.C
|
||||
}
|
||||
|
||||
var key database.APIKey
|
||||
if oldKey, ok := httpmw.APIKeyOptional(r); ok && isConvertLoginType {
|
||||
oldKey, _, ok := httpmw.APIKeyFromRequest(ctx, api.Database, nil, r)
|
||||
if ok && oldKey != nil && isConvertLoginType {
|
||||
// If this is a convert login type, and it succeeds, then delete the old
|
||||
// session. Force the user to log back in.
|
||||
err := api.Database.DeleteAPIKeyByID(r.Context(), oldKey.ID)
|
||||
@ -1447,7 +1448,9 @@ func (api *API) oauthLogin(r *http.Request, params *oauthLoginParams) ([]*http.C
|
||||
Secure: api.SecureAuthCookie,
|
||||
HttpOnly: true,
|
||||
})
|
||||
key = oldKey
|
||||
// This is intentional setting the key to the deleted old key,
|
||||
// as the user needs to be forced to log back in.
|
||||
key = *oldKey
|
||||
} else {
|
||||
//nolint:gocritic
|
||||
cookie, newKey, err := api.createAPIKey(dbauthz.AsSystemRestricted(ctx), apikey.CreateParams{
|
||||
|
Reference in New Issue
Block a user