MCPcopy Index your code
hub / github.com/21st-dev/1code / getValidToken

Method getValidToken

src/main/auth-manager.ts:88–98  ·  view source on GitHub ↗

* Get a valid token, refreshing if necessary

()

Source from the content-addressed store, hash-verified

86 * Get a valid token, refreshing if necessary
87 */
88 async getValidToken(): Promise<string | null> {
89 if (!this.store.isAuthenticated()) {
90 return null
91 }
92
93 if (this.store.needsRefresh()) {
94 await this.refresh()
95 }
96
97 return this.store.getToken()
98 }
99
100 /**
101 * Refresh the current session

Callers 7

updateUserMethod · 0.95
fetchUserPlanMethod · 0.95
registerIpcHandlersFunction · 0.80
getDesktopTokenFunction · 0.80
chats.tsFile · 0.80
sandbox-import.tsFile · 0.80
transcribeViaBackendFunction · 0.80

Calls 4

refreshMethod · 0.95
isAuthenticatedMethod · 0.45
needsRefreshMethod · 0.45
getTokenMethod · 0.45

Tested by

no test coverage detected