public async Task ActivateFactor(IUserFactor factor, string emailAddress, string passCode) { var user = await _client.Users.FirstOrDefaultAsync(u => u.Profile.Email.Equals(emailAddress)); if (user != default) { await factor.ActivateAsync(new ActivateFactorRequest { PassCode = passCode, }, user.Id); } }
/// <inheritdoc /> public async Task <IUserFactor> EnrollFactorAsync(IUserFactor body, string userId, bool?updatePhone = false, string templateId = null, int?tokenLifetimeSeconds = 300, bool?activate = false, CancellationToken cancellationToken = default(CancellationToken)) => await PostAsync <UserFactor>(new HttpRequest { Uri = "/api/v1/users/{userId}/factors", Verb = HttpVerb.Post, Payload = body, PathParameters = new Dictionary <string, object>() { ["userId"] = userId, }, QueryParameters = new Dictionary <string, object>() { ["updatePhone"] = updatePhone, ["templateId"] = templateId, ["tokenLifetimeSeconds"] = tokenLifetimeSeconds, ["activate"] = activate, }, }, cancellationToken).ConfigureAwait(false);