MCPcopy Create free account
hub / github.com/Web3Auth/Auth / addAuthenticatorFactor

Method addAuthenticatorFactor

src/core/auth.ts:390–409  ·  view source on GitHub ↗
(params: Pick<LoginParams, "appState">)

Source from the content-addressed store, hash-verified

388 }
389
390 async addAuthenticatorFactor(params: Pick<LoginParams, "appState">): Promise<boolean> {
391 if (!this.sessionId) throw LoginError.userNotLoggedIn();
392 await this.refreshSession();
393
394 const dataObject: AuthRequestPayload = {
395 actionType: AUTH_ACTIONS.ADD_AUTHENTICATOR_FACTOR,
396 options: { ...this.options, sdkMode: SDK_MODE.DEFAULT },
397 params: {
398 ...params,
399 authConnection: AUTH_CONNECTION.AUTHENTICATOR,
400 },
401 sessionId: this.sessionId,
402 accessToken: await this.getAccessToken(),
403 };
404
405 const result = await this.authHandler(`${this.baseUrl}/start`, dataObject);
406 if (!result) return false;
407 if (isAuthFlowError(result)) return false;
408 return true;
409 }
410
411 async addPasskeyFactor(params: Pick<LoginParams, "appState">): Promise<boolean> {
412 if (!this.sessionId) throw LoginError.userNotLoggedIn();

Callers

nothing calls this directly

Calls 5

refreshSessionMethod · 0.95
getAccessTokenMethod · 0.95
authHandlerMethod · 0.95
isAuthFlowErrorFunction · 0.90
userNotLoggedInMethod · 0.80

Tested by

no test coverage detected