Skip to content

Commit 535a658

Browse files
Add userinfo.email scope when in studio (#8935)
* Add userinfo.email scope when in studio * Update src/requireAuth.ts Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update src/requireAuth.ts Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 8894222 commit 535a658

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/requireAuth.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,11 @@ export async function requireAuth(
9696
skipAutoAuth: boolean = false,
9797
): Promise<string | null> {
9898
lastOptions = options;
99-
api.setScopes([scopes.CLOUD_PLATFORM, scopes.FIREBASE_PLATFORM]);
99+
const requiredScopes = [scopes.CLOUD_PLATFORM];
100+
if (isFirebaseStudio()) {
101+
requiredScopes.push(scopes.USERINFO_EMAIL);
102+
}
103+
api.setScopes(requiredScopes);
100104
options.authScopes = api.getScopes();
101105

102106
const tokens = options.tokens as Tokens | undefined;

src/scopes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// default scopes
22
export const OPENID = "openid";
33
export const EMAIL = "email";
4+
export const USERINFO_EMAIL = "https://www.googleapis.com/auth/userinfo.email";
45
export const CLOUD_PROJECTS_READONLY =
56
"https://www.googleapis.com/auth/cloudplatformprojects.readonly";
67
export const FIREBASE_PLATFORM = "https://www.googleapis.com/auth/firebase";

0 commit comments

Comments
 (0)