diff --git a/samples/sample-blazor/Program.cs b/samples/sample-blazor/Program.cs
index 6022c9a..be3ed15 100644
--- a/samples/sample-blazor/Program.cs
+++ b/samples/sample-blazor/Program.cs
@@ -54,12 +54,12 @@
///
///
- authProperties.SetParameter("first_screen", LogtoParameters.Authentication.FirstScreen.Register);
+ authProperties.SetParameter("first_screen", LogtoParameters.Authentication.FirstScreen.SignIn);
- // This parameter MUST be used together with `first_screen`.
- authProperties.SetParameter("identifiers", string.Join(",", new[]
+ authProperties.SetParameter("identifiers", System.Text.Json.JsonSerializer.Serialize(new[]
{
LogtoParameters.Authentication.Identifiers.Username,
+ LogtoParameters.Authentication.Identifiers.Email,
}));
var directSignIn = new LogtoParameters.Authentication.DirectSignIn
diff --git a/samples/sample-mvc/Controllers/HomeController.cs b/samples/sample-mvc/Controllers/HomeController.cs
index b0c813d..a657538 100644
--- a/samples/sample-mvc/Controllers/HomeController.cs
+++ b/samples/sample-mvc/Controllers/HomeController.cs
@@ -35,8 +35,7 @@ public IActionResult SignIn()
///
authProperties.SetParameter("first_screen", LogtoParameters.Authentication.FirstScreen.Register);
- // This parameter MUST be used together with `first_screen`.
- authProperties.SetParameter("identifiers", string.Join(",", new[]
+ authProperties.SetParameter("identifiers", JsonSerializer.Serialize(new[]
{
LogtoParameters.Authentication.Identifiers.Username,
}));
diff --git a/samples/sample/Pages/Index.cshtml.cs b/samples/sample/Pages/Index.cshtml.cs
index 1a94fc1..32d77ff 100644
--- a/samples/sample/Pages/Index.cshtml.cs
+++ b/samples/sample/Pages/Index.cshtml.cs
@@ -32,8 +32,7 @@ public async Task OnPostSignInAsync()
///
authProperties.SetParameter("first_screen", LogtoParameters.Authentication.FirstScreen.Register);
- // This parameter MUST be used together with `first_screen`
- authProperties.SetParameter("identifiers", string.Join(",", new[]
+ authProperties.SetParameter("identifiers", JsonSerializer.Serialize(new[]
{
LogtoParameters.Authentication.Identifiers.Username,
}));
diff --git a/src/Logto.AspNetCore.Authentication/extensions/AuthenticationBuilderExtensions.cs b/src/Logto.AspNetCore.Authentication/extensions/AuthenticationBuilderExtensions.cs
index 2688a3d..2b3080c 100644
--- a/src/Logto.AspNetCore.Authentication/extensions/AuthenticationBuilderExtensions.cs
+++ b/src/Logto.AspNetCore.Authentication/extensions/AuthenticationBuilderExtensions.cs
@@ -111,7 +111,13 @@ private static void ConfigureOpenIdConnectOptions(OpenIdConnectOptions options,
if (context.Properties.Parameters.TryGetValue("identifiers", out var identifiers))
{
- context.ProtocolMessage.Parameters.Add("identifiers", identifiers?.ToString());
+ var identifierArray = System.Text.Json.JsonSerializer.Deserialize(
+ identifiers?.ToString() ?? "[]"
+ );
+ if (identifierArray?.Length > 0)
+ {
+ context.ProtocolMessage.Parameters.Add("identifier", string.Join(" ", identifierArray));
+ }
}
if (context.Properties.Parameters.TryGetValue("direct_sign_in", out var directSignIn))