Skip to content

Commit 925b351

Browse files
authored
CLOUDP-117256: Improve expired code handling (#1093)
1 parent 4f69847 commit 925b351

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

internal/cli/auth/login.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ package auth
1616

1717
import (
1818
"context"
19+
"errors"
1920
"fmt"
2021
"os"
2122
"time"
@@ -160,6 +161,10 @@ Your code will expire after %.0f minutes.
160161
}
161162

162163
accessToken, _, err := opts.flow.PollToken(ctx, code)
164+
var target *atlas.ErrorResponse
165+
if errors.As(err, &target) && target.ErrorCode == "DEVICE_AUTHORIZATION_EXPIRED" {
166+
return errors.New("authentication timed out")
167+
}
163168
if err != nil {
164169
return err
165170
}

0 commit comments

Comments
 (0)