-
Notifications
You must be signed in to change notification settings - Fork 320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: External Authentication in Middleware #1391
Comments
I just encountered the same issue. I confirmed it seems to be related to Fluent Blazor. A vanilla Blazor application authenticates fine. |
Fluent button has both "name" and "Value". When the form is submitted these two values are concatenated together with a comma. Ex: "Google" becomes "Google,Google" and the login fails because there is no matching provider. This was copied directly from the default Blazor template and the FluentButton seems to behave differently than a stock html button.
The problem is the FluentButton provided by the Fluent new project template in ExternalLoginPicker. <FluentButton Type="ButtonType.Submit" Appearance="Appearance.Accent" name="provider" Value="@provider.Name" Title="@($"Log in using your {provider.DisplayName} account")">@provider.DisplayName If both "name" and "Value" are present it concatenates "Google,Google". If either one of them is removed, the provider comes back properly without the concatenation. I tried to fix the template myself, but I am too stupid. |
🐛 Bug Report
I've tried to add external authenticators to my app but the authenticator's schema name is being duplicated, even when specified.
💻 Repro or Code Sample
Update
Program.cs
to use external authentication:🤔 Expected Behavior
External authentication should work as it would using the default blazor template.
😯 Current Behavior
When the Google button is clicked I get the error below. The scheme is being recognized as "Google,Google" instead of "Google".
System.InvalidOperationException: No authentication handler is registered for the scheme 'Google,Google'. The registered schemes are: Google, Identity.Application, Identity.External, Identity.TwoFactorRememberMe, Identity.TwoFactorUserId. Did you forget to call AddAuthentication().AddSomeAuthHandler?
at Microsoft.AspNetCore.Authentication.AuthenticationService.ChallengeAsync(HttpContext context, String scheme, AuthenticationProperties properties)
at Microsoft.AspNetCore.Http.HttpResults.ChallengeHttpResult.ExecuteAsync(HttpContext httpContext)
at Microsoft.AspNetCore.Http.RequestDelegateFactory.ExecuteResultWriteResponse(IResult result, HttpContext httpContext)
at Microsoft.AspNetCore.Http.RequestDelegateFactory.<>c__DisplayClass104_2.<b__2>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Antiforgery.Internal.AntiforgeryMiddleware.InvokeAwaited(HttpContext context)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
💁 Possible Solution
🔦 Context
I'm trying to allow external logins to make it easier for users to register.
🌍 Your Environment
The text was updated successfully, but these errors were encountered: