( token: OAuth2TokenResponse, requestedScopes: readonly string[], )
| 205 | }; |
| 206 | |
| 207 | const recordedOAuthScope = ( |
| 208 | token: OAuth2TokenResponse, |
| 209 | requestedScopes: readonly string[], |
| 210 | ): string | null => { |
| 211 | if (token.scope == null) return requestedScopes.join(" ") || null; |
| 212 | |
| 213 | const granted = token.scope.split(/\s+/).filter(Boolean); |
| 214 | const coveredByRefreshToken = |
| 215 | token.refresh_token && requestedScopes.includes("offline_access") ? ["offline_access"] : []; |
| 216 | const recorded = dedupeScopes([...granted, ...coveredByRefreshToken]); |
| 217 | return recorded.join(" ") || null; |
| 218 | }; |
| 219 | |
| 220 | const OAUTH_SCOPE_ALIASES: Readonly<Record<string, string>> = { |
| 221 | "https://www.googleapis.com/auth/userinfo.email": "email", |
no test coverage detected