Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

bug: api key not refreshed when api key expired but oauth2 access token not #17070

Closed
Assignees
spikecurtis
Labels
s2Broken use cases or features (with a workaround). Only humans may set this.
@hugodutka

Description

@hugodutka

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

We havea system that refreshes expired api keys backed by oauth2 if a refresh token is available.

However, in the case when the api key is expired but the oauth2 access token isn’t, the refresh logic is not triggered, and the api keyExpiresAt field is not updated.

Relavant check:

iflink.OAuthExpiry.Before(now)&&!link.OAuthExpiry.IsZero()&&link.OAuthRefreshToken!="" {

Early exit ifExpiresAt is not updated.

ifkey.ExpiresAt.Before(now) {
returnoptionalWrite(http.StatusUnauthorized, codersdk.Response{
Message:SignedOutErrorMessage,
Detail:fmt.Sprintf("API key expired at %q.",key.ExpiresAt.String()),
})
}

Relevant Log Output

Expected Behavior

I'd expect theExpiresAt field to be updated when a valid OAuth2 access token is available.

Steps to Reproduce

The way I triggered it is I manually updated theExpiresAt field on an api key to the current time via a SQL query and then refreshed the Coder web UI.

Environment

  • Host OS: Linux
  • Coder version: 2.20.2

Additional Context

No response

Metadata

Metadata

Assignees

Labels

s2Broken use cases or features (with a workaround). Only humans may set this.

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp