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

Support multiple accounts #3192

Merged
merged 27 commits into from
Apr 6, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
98faa1e
Get basic commands in place
samtstern Mar 5, 2021
75dcfdf
Functions emulator args
samtstern Mar 8, 2021
4f7aa73
Logout
samtstern Mar 8, 2021
1b203e3
Fix compile
samtstern Mar 8, 2021
a83bf46
Handle token refreshing
samtstern Mar 8, 2021
575fb0c
Lint
samtstern Mar 8, 2021
25d4347
Fix tests
samtstern Mar 8, 2021
8a06b92
Fix inherited option bug
samtstern Mar 9, 2021
e3d2e78
Make firebase init work
samtstern Mar 9, 2021
8c9493a
Add some docstrings, clean up some global state
samtstern Mar 9, 2021
a8aef0a
Unit tests
samtstern Mar 9, 2021
209e209
Merge branch 'master' into ss-multi-auth
samtstern Mar 9, 2021
65a9bf3
Changelog
samtstern Mar 9, 2021
b9f5379
Fix unit tests
samtstern Mar 9, 2021
0397763
Fix inherited option issue with account
samtstern Mar 9, 2021
c01acf5
Review comments
samtstern Mar 16, 2021
22c9cdd
Merge remote-tracking branch 'github/master' into ss-multi-auth
samtstern Mar 16, 2021
851323f
Fix imports
samtstern Mar 16, 2021
17e3dde
Apply suggestions from code review
samtstern Mar 17, 2021
0d409f8
Merge branch 'master' into ss-multi-auth
samtstern Mar 17, 2021
d8754a4
Merge remote-tracking branch 'github/master' into ss-multi-auth
samtstern Mar 23, 2021
12fa104
Review comments
samtstern Mar 23, 2021
bfd9211
Merge branch 'ss-multi-auth' of github.com:firebase/firebase-tools in…
samtstern Mar 23, 2021
a6a5cd7
Prompt for new account if logging out of global default
samtstern Apr 6, 2021
b2bf7ca
Fix duplicate accounts
samtstern Apr 6, 2021
faea732
Fix requirePermissions issue
samtstern Apr 6, 2021
f3ec559
Merge branch 'master' into ss-multi-auth
samtstern Apr 6, 2021
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
Prev Previous commit
Next Next commit
Fix inherited option bug
  • Loading branch information
samtstern committed Mar 9, 2021
commit 8a06b92c18a41c874e276f2f7b9b758ec58015a0
14 changes: 10 additions & 4 deletions src/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,16 @@ export class Command {
validateProjectId(options.project);
}

const account = setupAccount(options);
if (account) {
options.user = account.user;
options.tokens = account.tokens;
const account = getInheritedOption(options, "account");
const projectRoot = options.projectRoot;
const activeAccount = setupAccount({
account,
projectRoot
});

if (activeAccount) {
options.user = activeAccount.user;
options.tokens = activeAccount.tokens;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/requireAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export async function requireAuth(options: any): Promise<void> {
} else if (process.env.FIREBASE_TOKEN) {
logger.debug("> authorizing via FIREBASE_TOKEN environment variable");
} else if (user) {
logger.debug("> authorizing via signed-in user");
logger.debug(`> authorizing via signed-in user (${user.email})`);
} else {
try {
return await autoAuth(options, options.authScopes);
Expand Down
6 changes: 6 additions & 0 deletions src/test/multiAuth.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { expect } from "chai";
import { resolve } from "path";

describe("multiAuth", () => {
samtstern marked this conversation as resolved.
Show resolved Hide resolved

});