( token: OAuth2TokenResponse, requestedScopes: readonly string[], )
| 318 | }; |
| 319 | |
| 320 | const recordedOAuthScope = ( |
| 321 | token: OAuth2TokenResponse, |
| 322 | requestedScopes: readonly string[], |
| 323 | ): string | null => { |
| 324 | if (token.scope == null) return requestedScopes.join(" ") || null; |
| 325 | |
| 326 | const granted = token.scope.split(/\s+/).filter(Boolean); |
| 327 | const coveredByRefreshToken = |
| 328 | token.refresh_token && requestedScopes.includes("offline_access") ? ["offline_access"] : []; |
| 329 | const recorded = dedupeScopes([...granted, ...coveredByRefreshToken]); |
| 330 | return recorded.join(" ") || null; |
| 331 | }; |
| 332 | |
| 333 | const OAUTH_SCOPE_ALIASES: Readonly<Record<string, string>> = { |
| 334 | "https://www.googleapis.com/auth/userinfo.email": "email", |
no test coverage detected