MCPcopy Create free account
hub / github.com/Kong/insomnia / onAuthFailure

Function onAuthFailure

packages/insomnia/src/sync/git/utils.ts:31–56  ·  view source on GitHub ↗
(credentialsId?: string | null)

Source from the content-addressed store, hash-verified

29};
30
31const onAuthFailure = (credentialsId?: string | null): AuthFailureCallback => {
32 return async url => {
33 console.log(`[git-event] Auth Failure: ${url}`);
34
35 try {
36 invariant(credentialsId, 'No credentials ID provided for auth failure handling');
37 const credentials = await services.gitCredentials.getById(credentialsId);
38 invariant(credentials, 'Credentials not found for auth failure handling');
39 invariant(isGitCredentialsV2(credentials), 'Legacy credentials are not supported');
40
41 const provider = gitRemoteProviderRegistry.get(credentials.provider);
42
43 if (!provider || !provider.authFailureCallback) {
44 console.log('[git-event] No provider or auth failure callback available');
45 return;
46 }
47
48 const authFailureCallback = provider.authFailureCallback(credentials);
49
50 return authFailureCallback;
51 } catch (error) {
52 console.warn('[git-event] Failed to refresh token', error);
53 return;
54 }
55 };
56};
57
58const onAuthSuccess: AuthSuccessCallback = message => {
59 console.log(`[git-event] Auth Success: ${message}`);

Callers 1

gitCallbacksFunction · 0.85

Calls 5

invariantFunction · 0.90
isGitCredentialsV2Function · 0.85
authFailureCallbackMethod · 0.65
logMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected