Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always log reauth error messages #7875

Merged
merged 4 commits into from
Nov 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
return getGlobalDefaultAccount();
}

const activeAccounts = configstore.get("activeAccounts") || {};

Check warning on line 74 in src/auth.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value
const email: string | undefined = activeAccounts[projectDir];

Check warning on line 75 in src/auth.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value

Check warning on line 75 in src/auth.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access [projectDir] on an `any` value

if (!email) {
return getGlobalDefaultAccount();
Expand All @@ -86,7 +86,7 @@
* Get all authenticated accounts _besides_ the default account.
*/
export function getAdditionalAccounts(): Account[] {
return configstore.get("additionalAccounts") || [];

Check warning on line 89 in src/auth.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe return of an `any` typed value
}

/**
Expand All @@ -111,20 +111,20 @@
* @param options options object.
* @param account account to make active.
*/
export function setActiveAccount(options: any, account: Account) {

Check warning on line 114 in src/auth.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing return type on function

Check warning on line 114 in src/auth.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
if (account.tokens.refresh_token) {
setRefreshToken(account.tokens.refresh_token);
}

options.user = account.user;

Check warning on line 119 in src/auth.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .user on an `any` value
options.tokens = account.tokens;

Check warning on line 120 in src/auth.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .tokens on an `any` value
}

/**
* Set the global refresh token in both api and apiv2.
* @param token refresh token string
*/
export function setRefreshToken(token: string) {

Check warning on line 127 in src/auth.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing return type on function
apiv2.setRefreshToken(token);
}

Expand Down Expand Up @@ -162,7 +162,7 @@
* @param useLocalhost should the flow be interactive or code-based?
* @param email an optional hint to use for the google account picker
*/
export async function loginAdditionalAccount(useLocalhost: boolean, email?: string) {

Check warning on line 165 in src/auth.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing return type on function
// Log the user in using the passed email as a hint
const result = await loginGoogle(useLocalhost, email);

Expand Down Expand Up @@ -230,14 +230,14 @@

// Always create a new error so that the stack is useful
function invalidCredentialError(): FirebaseError {
return new FirebaseError(
const message =
"Authentication Error: Your credentials are no longer valid. Please run " +
clc.bold("firebase login --reauth") +
"\n\n" +
"For CI servers and headless environments, generate a new token with " +
clc.bold("firebase login:ci"),
{ exit: 1 },
);
clc.bold("firebase login --reauth") +
"\n\n" +
"For CI servers and headless environments, generate a new token with " +
clc.bold("firebase login:ci");
logger.error(message);
return new FirebaseError(message, { exit: 1 });
}

const FIFTEEN_MINUTES_IN_MS = 15 * 60 * 1000;
Expand Down
Loading