Example #1
0
        /// <inheritdoc/>
        public async Task <IAuthenticationResponse> EnrollFactorAsync(EnrollSmsFactorOptions factorOptions, CancellationToken cancellationToken = default)
        {
            var profile = new Resource();

            profile.SetProperty("phoneNumber", factorOptions.PhoneNumber);
            profile.SetProperty("phoneExtension", factorOptions.PhoneExtension);

            var enrollSmsFactor = new EnrollFactorRequest()
            {
                StateToken = factorOptions.StateToken,
                FactorType = FactorType.Sms,
                Provider   = factorOptions.Provider,
                Profile    = profile,
            };

            return(await EnrollFactorAsync(enrollSmsFactor, cancellationToken));
        }
Example #2
0
        /// <inheritdoc/>
        public async Task <IAuthenticationResponse> ResendSmsEnrollFactorAsync(EnrollSmsFactorOptions factorOptions, CancellationToken cancellationToken = default)
        {
            var profile = new Resource();

            profile.SetProperty("phoneNumber", factorOptions.PhoneNumber);
            profile.SetProperty("phoneExtension", factorOptions.PhoneExtension);

            var enrollSmsFactorRequest = new EnrollFactorRequest()
            {
                StateToken = factorOptions.StateToken,
                FactorType = FactorType.Sms,
                Provider   = factorOptions.Provider,
                Profile    = profile,
            };

            return(await PostAsync <AuthenticationResponse>(
                       new HttpRequest
            {
                Uri = $"/api/v1/authn/factors/{factorOptions.FactorId}/lifecycle/resend",
                Payload = enrollSmsFactorRequest,
            }, cancellationToken).ConfigureAwait(false));
        }