MCPcopy Index your code
hub / github.com/QLHazyCoder/FlowPilot / isLocalhostOAuthCallbackTabMatch

Function isLocalhostOAuthCallbackTabMatch

background/tab-runtime.js:88–99  ·  view source on GitHub ↗
(callbackUrl, candidateUrl)

Source from the content-addressed store, hash-verified

86 }
87
88 function isLocalhostOAuthCallbackTabMatch(callbackUrl, candidateUrl) {
89 if (!isLocalhostOAuthCallbackUrl(callbackUrl) || !isLocalhostOAuthCallbackUrl(candidateUrl)) {
90 return false;
91 }
92
93 const callback = new URL(callbackUrl);
94 const candidate = new URL(candidateUrl);
95 return callback.origin === candidate.origin
96 && callback.pathname === candidate.pathname
97 && callback.searchParams.get('code') === candidate.searchParams.get('code')
98 && callback.searchParams.get('state') === candidate.searchParams.get('state');
99 }
100
101 async function closeLocalhostCallbackTabs(callbackUrl, options = {}) {
102 if (!isLocalhostOAuthCallbackUrl(callbackUrl)) return 0;

Callers 1

Calls 1

Tested by

no test coverage detected