Skip to content

Commit 67d4028

Browse files
nil nil on invalid refresh, write to file
1 parent 3201a53 commit 67d4028

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pkg/auth/kas.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"fmt"
77
"io"
88
"net/http"
9+
"os"
910
"strings"
1011
"time"
1112

@@ -50,7 +51,9 @@ func NewKasAuthenticator(email, baseURL, issuer string, shouldPromptEmail bool,
5051
func (a KasAuthenticator) GetNewAuthTokensWithRefresh(refreshToken string) (*entity.AuthTokens, error) {
5152
splitRefreshToken := strings.Split(refreshToken, ":")
5253
if len(splitRefreshToken) != 2 {
53-
return nil, fmt.Errorf("invalid refresh token")
54+
// Write the invalid refresh token to the specified file
55+
_ = os.WriteFile("/.brev/.invalid-refresh-token", []byte(refreshToken), 0o600)
56+
return nil, nil
5457
}
5558
sessionKey, deviceID := splitRefreshToken[0], splitRefreshToken[1]
5659
token, err := a.retrieveIDToken(sessionKey, deviceID)

0 commit comments

Comments
 (0)