( token: OAuth2TokenResponse, requestedScopes: readonly string[], )
| 191 | }; |
| 192 | |
| 193 | const recordedOAuthScope = ( |
| 194 | token: OAuth2TokenResponse, |
| 195 | requestedScopes: readonly string[], |
| 196 | ): string | null => { |
| 197 | if (token.scope == null) return requestedScopes.join(" ") || null; |
| 198 | |
| 199 | const granted = token.scope.split(/\s+/).filter(Boolean); |
| 200 | const coveredByRefreshToken = |
| 201 | token.refresh_token && requestedScopes.includes("offline_access") ? ["offline_access"] : []; |
| 202 | const recorded = dedupeScopes([...granted, ...coveredByRefreshToken]); |
| 203 | return recorded.join(" ") || null; |
| 204 | }; |
| 205 | |
| 206 | const decodeJsonPayload = Schema.decodeUnknownOption(Schema.UnknownFromJsonString); |
| 207 |
no test coverage detected