MCPcopy Create free account
hub / github.com/InverseUI/InverseUI-Recorder / getTokenFromCookie

Function getTokenFromCookie

api/auth.js:8–35  ·  view source on GitHub ↗

* Get auth token from cookies * @returns {Promise }

()

Source from the content-addressed store, hash-verified

6 * @returns {Promise<string|null>}
7 */
8async function getTokenFromCookie() {
9 try {
10 // Get configuration to determine which domain to check
11 const domain = 'inverseui.com';
12
13 // Get all cookies for the domain to debug
14 const allCookies = await chrome.cookies.getAll({
15 domain: domain.startsWith('.') ? domain : `.${domain}`
16 });
17 console.log(`All cookies for ${domain}:`, allCookies);
18
19 // Get specific cookie from domain
20 // Using getAll with specific name since get() might have issues with domain cookies
21 const cookies = await chrome.cookies.getAll({
22 domain: domain.startsWith('.') ? domain : `.${domain}`,
23 name: 'inverseui_auth_token'
24 });
25
26 if (cookies && cookies.length > 0) {
27 return cookies[0].value;
28 }
29
30 return null;
31 } catch (error) {
32 console.error('Failed to read auth cookie:', error);
33 return null;
34 }
35}
36
37/**
38 * Check if user is authenticated

Callers 2

checkAuthFunction · 0.85
getAuthTokenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected