Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review: check all required OAuth scopes in needsScopeUpgrade

Adam Eivy00621a1d0b95
diff --git a/server/services/googleAuth.js b/server/services/googleAuth.js
index f00b4158fb..4664d6c3d8 100644
--- a/server/services/googleAuth.js
+++ b/server/services/googleAuth.js
@@ -121,9 +121,8 @@ export async function getAuthenticatedClient() {
export function needsScopeUpgrade(tokens) {
if (!tokens?.scope) return true;
const scopes = tokens.scope.split(' ');
- // Has readonly but not full calendar scope
- return scopes.includes('https://www.googleapis.com/auth/calendar.readonly') &&
- !scopes.includes('https://www.googleapis.com/auth/calendar');
+ // Check all required scopes are present
+ return !SCOPES.every(s => scopes.includes(s));
}
export async function getAuthStatus() {
@@ -133,6 +132,6 @@ export async function getAuthStatus() {
hasCredentials: !!credentials?.clientId,
hasTokens: !!tokens?.access_token,
expiryDate: tokens?.expiry_date ? new Date(tokens.expiry_date).toISOString() : null,
- needsCalendarScopeUpgrade: needsScopeUpgrade(tokens)
+ needsScopeUpgrade: needsScopeUpgrade(tokens)
};
}