public async Task <StatusBuilder> VerifyAuthenticator([FromBody] VerificationCodeDetails code)
        {
            var results = this.HandleModelState();

            if (results.IsSuccessful)
            {
                results = await _twoFactorService.VerifyAuthenticatorCode(User, code);

                if (results.IsSuccessful)
                {
                    var recoveryCodes = results.GetDataAs <List <String> >();
                }
            }

            return(results);
        }
        // The data returned by the status builder upon success is any available recovery codes
        public async Task <StatusBuilder> VerifyAuthenticatorCode(ClaimsPrincipal principal, VerificationCodeDetails code)
        {
            var output = new StatusBuilder();

            var user = await _userManager.GetUserAsync(principal);

            var verificationCode = code.VerificationCode.Replace(" ", string.Empty).Replace("-", string.Empty);

            var is2FaTokenValid = await _userManager.VerifyTwoFactorTokenAsync(user, _userManager.Options.Tokens.AuthenticatorTokenProvider, verificationCode);

            if (is2FaTokenValid)
            {
                var results = await _userManager.SetTwoFactorEnabledAsync(user, true);

                if (results.Succeeded)
                {
                    output.SetMessage("Your authenticator app has been verified");

                    if (await _userManager.CountRecoveryCodesAsync(user) == 0)
                    {
                        var recoveryCodes = await _userManager.GenerateNewTwoFactorRecoveryCodesAsync(user, 10);

                        output.SetData(recoveryCodes.ToList());
                    }
                }
                else
                {
                    foreach (var err in results.Errors)
                    {
                        output.RecordFailure(err.Description, err.Code);
                    }
                }
            }
            else
            {
                output.RecordFailure("Verification code is invalid");
            }

            return(output);
        }