• Resend two factor code handler

    Parameters

    • userAPI: Pick<UserDefaultAdapterAPI, "getUserById">

      injected API service use to handle the user related operations

      • getUserById
    • twoFactorAuthService: TwoFactorAuthService

      injected service use to handle the two factor auth related operations

      • generateCode
      • sendMail
    • authSecrets: AuthSecrets
    • logger: Logger

      injected logger used to handle the logging

    • context: AdapterHandlerContext

      request context [body].

    Returns Promise<adapter.AdapterHandlerResponse>

    200 Status Ok

    {
    data: {
    token: string,
    },
    status: statusCode,
    }

    Description

    This handler will resend a two factor authentication code by applying the following steps in sequence:

    1. Get token from request body

    2. Get user info and invalidate token (twoFactorAuthService.invalidateToken)

    3. Generate 2FA code if (twoFactorAuthService.generateCode)

    4. Send 2FA code to user (twoFactorAuthService.sendMail)

    5. Return the response

    Throws

    400 NBError invalid body

    • body is invalid

    Throws

    401 NBError invalid token

    • token is invalid

    Throws

    404 NBError not found

    • token is not found
    • user is not found

    Throws

    500 NBError Internal Server Error

    • 2FA_code generate failed

Generated using TypeDoc