Skip to content

Commit c7fc626

Browse files
committed
Fix for PasswordlessEmailRequest passing literal NULL no client_secret was provided
1 parent d0fbc53 commit c7fc626

File tree

2 files changed

+31
-5
lines changed

2 files changed

+31
-5
lines changed

src/Auth0.AuthenticationApi/AuthenticationApiClient.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,8 @@ public Task<PasswordlessEmailResponse> StartPasswordlessEmailFlowAsync(Passwordl
395395
}
396396
else
397397
{
398-
body.client_secret = request.ClientSecret;
398+
if (!string.IsNullOrEmpty(request.ClientSecret))
399+
body.client_secret = request.ClientSecret;
399400
}
400401

401402
return connection.SendAsync<PasswordlessEmailResponse>(

tests/Auth0.AuthenticationApi.IntegrationTests/PasswordlessTests.cs

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
using Auth0.AuthenticationApi.Models;
2-
using Auth0.Tests.Shared;
3-
using FluentAssertions;
4-
using System.Collections.Generic;
1+
using System.Collections.Generic;
52
using System.Linq;
63
using System.Net;
74
using System.Net.Http;
85
using System.Text;
96
using System.Threading;
107
using System.Threading.Tasks;
118
using System.Web;
9+
10+
using FluentAssertions;
1211
using Xunit;
1312
using Moq;
1413
using Moq.Protected;
1514
using Newtonsoft.Json;
1615

16+
using Auth0.AuthenticationApi.Models;
17+
using Auth0.Tests.Shared;
18+
1719
namespace Auth0.AuthenticationApi.IntegrationTests
1820
{
1921
public class PasswordlessTests : TestBase
@@ -95,6 +97,29 @@ public async Task Can_launch_email_code_flow()
9597
response.EmailVerified.Should().NotBeNull();
9698
}
9799

100+
[SkippableFact]
101+
public async Task Can_launch_email_code_flow_for_SPA()
102+
{
103+
Skip.If(string.IsNullOrEmpty(email), "AUTH0_PASSWORDLESSDEMO_EMAIL not set");
104+
105+
var request = new PasswordlessEmailRequest
106+
{
107+
ClientId = "Qpnq5llXeWEn1o1iLYNQSr3zFI1YPg3K",
108+
Email = email,
109+
Type = PasswordlessEmailRequestType.Code,
110+
AuthenticationParameters = new Dictionary<string, object>
111+
{
112+
["audience"] = "settings.Audience",
113+
["scope"] = "openid profile email offline_access",
114+
}
115+
};
116+
var response = await authenticationApiClient.StartPasswordlessEmailFlowAsync(request);
117+
response.Should().NotBeNull();
118+
response.Email.Should().Be(request.Email);
119+
response.Id.Should().NotBeNullOrEmpty();
120+
response.EmailVerified.Should().NotBeNull();
121+
}
122+
98123
[SkippableFact]
99124
public async Task Can_launch_sms_flow()
100125
{

0 commit comments

Comments
 (0)