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