Example #1
0
        public async Task Can_launch_email_link_flow_with_auth_parameters()
        {
            Skip.If(string.IsNullOrEmpty(email), "AUTH0_PASSWORDLESSDEMO_EMAIL not set");

            var request = new PasswordlessEmailRequest
            {
                ClientId                 = GetVariable("AUTH0_CLIENT_ID"),
                ClientSecret             = GetVariable("AUTH0_CLIENT_SECRET"),
                Email                    = email,
                Type                     = PasswordlessEmailRequestType.Link,
                AuthenticationParameters = new Dictionary <string, object>()
                {
                    { "response_type", "code" },
                    { "scope", "openid" },
                    { "nonce", "mynonce" },
                    { "redirect_uri", "http://localhost:5000/signin-auth0" }
                }
            };

            var response = await authenticationApiClient.StartPasswordlessEmailFlowAsync(request);

            response.Should().NotBeNull();
            response.Email.Should().Be(request.Email);
            response.Id.Should().NotBeNullOrEmpty();
            response.EmailVerified.Should().NotBeNull();
        }
Example #2
0
        public async Task Can_launch_email_link_flow_with_auth_parameters()
        {
            // Arrange
            using (var authenticationApiClient = new AuthenticationApiClient(GetVariable("AUTH0_AUTHENTICATION_API_URL")))
            {
                // Act
                var request = new PasswordlessEmailRequest
                {
                    ClientId = GetVariable("AUTH0_CLIENT_ID"),
                    Email    = "your email",
                    Type     = PasswordlessEmailRequestType.Link,
                    AuthenticationParameters = new Dictionary <string, object>()
                    {
                        { "response_type", "code" },
                        { "scope", "openid" },
                        { "nonce", "mynonce" },
                        { "redirect_uri", "http://localhost:5000/signin-auth0" }
                    }
                };
                var response = await authenticationApiClient.StartPasswordlessEmailFlowAsync(request);

                response.Should().NotBeNull();
                response.Email.Should().Be(request.Email);
            }
        }
 /// <summary>
 /// Starts a new Passwordless email flow.
 /// </summary>
 /// <param name="request">The <see cref="PasswordlessEmailRequest" /> containing the information about the new Passwordless flow to start.</param>
 /// <returns>A <see cref="PasswordlessEmailResponse" /> containing the response.</returns>
 public Task <PasswordlessEmailResponse> StartPasswordlessEmailFlowAsync(PasswordlessEmailRequest request)
 {
     return(Connection.PostAsync <PasswordlessEmailResponse>("passwordless/start",
                                                             new
     {
         client_id = request.ClientId,
         connection = "email",
         email = request.Email,
         send = request.Type.ToString().ToLower(),
         authParams = request.AuthenticationParameters
     },
                                                             null, null, null, null, null));
 }
Example #4
0
        public async Task Can_launch_email_code_flow()
        {
            // Arrange
            var authenticationApiClient = new AuthenticationApiClient(new Uri(GetVariable("AUTH0_AUTHENTICATION_API_URL")));

            // Act
            var request = new PasswordlessEmailRequest
            {
                ClientId = GetVariable("AUTH0_CLIENT_ID"),
                Email    = "your email",
                Type     = PasswordlessEmailRequestType.Code
            };
            var response = await authenticationApiClient.StartPasswordlessEmailFlowAsync(request);

            response.Should().NotBeNull();
            response.Email.Should().Be(request.Email);
        }
Example #5
0
        public async Task Can_launch_email_code_flow()
        {
            Skip.If(string.IsNullOrEmpty(email), "AUTH0_PASSWORDLESSDEMO_EMAIL not set");

            var request = new PasswordlessEmailRequest
            {
                ClientId     = GetVariable("AUTH0_CLIENT_ID"),
                ClientSecret = GetVariable("AUTH0_CLIENT_SECRET"),
                Email        = email,
                Type         = PasswordlessEmailRequestType.Code
            };
            var response = await authenticationApiClient.StartPasswordlessEmailFlowAsync(request);

            response.Should().NotBeNull();
            response.Email.Should().Be(request.Email);
            response.Id.Should().NotBeNullOrEmpty();
            response.EmailVerified.Should().NotBeNull();
        }
Example #6
0
        /// <inheritdoc/>
        public Task <PasswordlessEmailResponse> StartPasswordlessEmailFlowAsync(PasswordlessEmailRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            var body = new
            {
                client_id  = request.ClientId,
                connection = "email",
                email      = request.Email,
                send       = request.Type.ToString().ToLower(),
                authParams = request.AuthenticationParameters
            };

            return(connection.SendAsync <PasswordlessEmailResponse>(
                       HttpMethod.Post,
                       BuildUri("passwordless/start"),
                       body));
        }
 public Task <PasswordlessEmailResponse> StartPasswordlessEmailFlowAsync(PasswordlessEmailRequest request)
 {
     return(_inner.StartPasswordlessEmailFlowAsync(request));
 }
 public Task <PasswordlessEmailResponse> StartPasswordlessEmailFlowAsync(PasswordlessEmailRequest request, CancellationToken cancellationToken = default)
 {
     return(_inner.StartPasswordlessEmailFlowAsync(request, cancellationToken));
 }