MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / logoutUser

Function logoutUser

cli/src/utils/auth.ts:214–246  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

212}
213
214export async function logoutUser(): Promise<boolean> {
215 try {
216 const user = getUserCredentials()
217 if (user?.authToken) {
218 setApiClientAuthToken(user.authToken)
219 const apiClient = getApiClient()
220 try {
221 const response = await apiClient.logout({
222 userId: user.id,
223 fingerprintId: user.fingerprintId,
224 fingerprintHash: user.fingerprintHash,
225 })
226 if (!response.ok) {
227 logger.error(
228 { status: response.status, error: response.error },
229 'Logout request failed',
230 )
231 }
232 } catch (err) {
233 logger.error(err, 'Logout request error')
234 }
235 }
236 } catch (error) {
237 logger.error(error, 'Unexpected error preparing logout')
238 }
239
240 try {
241 clearUserCredentials()
242 } catch (error) {
243 logger.debug({ error }, 'Failed to clear credentials during logout')
244 }
245 return true
246}

Callers 1

Calls 5

setApiClientAuthTokenFunction · 0.90
getApiClientFunction · 0.90
clearUserCredentialsFunction · 0.85
logoutMethod · 0.80
getUserCredentialsFunction · 0.70

Tested by

no test coverage detected