Skip to content

Commit 043004f

Browse files
committed
explain valid token in apikey_test.go
1 parent cc3394b commit 043004f

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

coderd/httpmw/apikey_test.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -530,10 +530,13 @@ func TestAPIKey(t *testing.T) {
530530
)
531531
r.Header.Set(codersdk.SessionTokenHeader, token)
532532

533-
oauthToken := &oauth2.Token{
534-
AccessToken: "wow",
535-
RefreshToken: "moo",
536-
Expiry: dbtime.Now().AddDate(0, 0, 1),
533+
// Include a valid oauth token for refreshing. If this token is invalid,
534+
// it is difficult to tell an auth failure from a expired api key, or
535+
// an expired oauth key.
536+
oauthToken := &oauth2.Token{
537+
AccessToken: "wow",
538+
RefreshToken: "moo",
539+
Expiry: dbtime.Now().AddDate(0, 0, 1),
537540
}
538541
httpmw.ExtractAPIKeyMW(httpmw.ExtractAPIKeyConfig{
539542
DB: db,

0 commit comments

Comments
 (0)