Skip to content

Commit

Permalink
fix: check vercel token is still valid (#7325)
Browse files Browse the repository at this point in the history
### Description
We should _at least_ check to see if the token we see in `com.vercel.cli` is able to fetch the user.


Closes TURBO-2300
  • Loading branch information
Zertsov committed Feb 8, 2024
1 parent cc58000 commit 0ea4fd1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
8 changes: 3 additions & 5 deletions crates/turborepo-auth/src/auth/login.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,10 @@ pub async fn login<T: Client>(options: &LoginOptions<'_, T>) -> Result<Token, Er

// If the user is logging into Vercel, check for an existing `vc` token.
if login_url_configuration.contains("vercel.com") {
// The extraction can return an error, but we don't want to fail the login if
// the token is not found.
if let Ok(token) = extract_vercel_token() {
println!(
"{}",
ui.apply(BOLD.apply_to("Existing Vercel token found!"))
);
return Ok(Token::Existing(token));
return check_token(&token, ui, api_client, "Existing Vercel token found!").await;
}
}

Expand Down
5 changes: 0 additions & 5 deletions turborepo-tests/integration/tests/command-login.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,3 @@ Setup
Login Test Run
$ ${TURBO} login --__test-run
Login test run successful

Login reuses Vercel CLI token
$ . ${TESTDIR}/../../helpers/mock_existing_login.sh
$ ${TURBO} login
Existing Vercel token found!

0 comments on commit 0ea4fd1

Please sign in to comment.