MCPcopy
hub / github.com/upstash/context7 / loadTokens

Function loadTokens

packages/cli/src/utils/auth.ts:48–63  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

46}
47
48export function loadTokens(): TokenData | null {
49 const credentialsFile = resolveReadPathSync(
50 CREDENTIALS_FILE_NAME,
51 getCredentialsFilePath(),
52 CREDENTIALS_MODE
53 );
54 if (!fs.existsSync(credentialsFile)) {
55 return null;
56 }
57 try {
58 const data = JSON.parse(fs.readFileSync(credentialsFile, "utf-8"));
59 return data as TokenData;
60 } catch {
61 return null;
62 }
63}
64
65export function clearTokens(): boolean {
66 const credentialsFile = getCredentialsFilePath();

Callers 5

getValidAccessTokenFunction · 0.85
getAccessTokenFunction · 0.85
generateCommandFunction · 0.85
suggestCommandFunction · 0.85
auth-utils.test.tsFile · 0.85

Calls 2

resolveReadPathSyncFunction · 0.85
getCredentialsFilePathFunction · 0.85

Tested by

no test coverage detected