- ๐ญ Iโm currently working on WireMock.Net
- ๐ฑ Iโm currently learning more Azure and Blazor
Environments
Languages
Frontends
Blazor WebAssembly Auth0 Oidc Authentication with support for Audience
License: MIT License
Environments
Languages
Frontends
Hello,
I am currently using the Nuget of this repo for my Blazor App with user login. Now I am trying to implement a display with status information in another Blazor App but since it is just a display I want to use client credentials but have to also be able to call the API.
So would it be possible to integrate the possibility of also sending the client_secret
so that the application does not need a user to sign in?
Best regards
Dennis Rahmen
Hello,
If I use default value of ProviderOptions.ResponseType then following code works:
private static void ConfigureServices(this IServiceCollection services, IConfiguration config)
{
services.AddAuth0Authentication(options =>
{
options.ProviderOptions.Audience = config["Authentication:Audience"];
options.ProviderOptions.Authority = config["Authentication:Authority"];
options.ProviderOptions.ClientId = config["Authentication:ClientId"];
options.ProviderOptions.ResponseType = "token id_token";
options.ProviderOptions.RedirectUri = "authentication/login-callback";
options.ProviderOptions.PostLogoutRedirectUri = "authentication/logout-callback";
options.ProviderOptions.DefaultScopes.Add("email");
options.AuthenticationPaths.LogOutSucceededPath = "/";
foreach (var permission in Permission.List)
{
options.ProviderOptions.DefaultScopes.Add(permission.Value);
}
}).AddAccountClaimsPrincipalFactory<AfoConnectPrincipalFactory>();
....
}
But if I tried to use options.ProviderOptions.ResponseType = "post_form";
then there is problem.
private static void ConfigureServices(this IServiceCollection services, IConfiguration config)
{
services.AddAuth0Authentication(options =>
{
options.ProviderOptions.Audience = config["Authentication:Audience"];
options.ProviderOptions.Authority = config["Authentication:Authority"];
options.ProviderOptions.ClientId = config["Authentication:ClientId"];
options.ProviderOptions.ResponseType = "token id_token";
options.ProviderOptions.RedirectUri = "authentication/login-callback";
options.ProviderOptions.PostLogoutRedirectUri = "authentication/logout-callback";
options.ProviderOptions.DefaultScopes.Add("email");
options.AuthenticationPaths.LogOutSucceededPath = "/";
options.ProviderOptions.ResponseType = "post_form";
foreach (var permission in Permission.List)
{
options.ProviderOptions.DefaultScopes.Add(permission.Value);
}
}).AddAccountClaimsPrincipalFactory<AfoConnectPrincipalFactory>();
...
}
How to use POST method?
Thank you.
Microsoft has added an AdditionalProviderParameters property to OidcProviderOptions in .NET 6.0. This creates a serializer conflict for anyone using this package and updating their project.
You receive the following error message on Blazor app startup: Unhandled exception rendering component: The JSON property name for 'Microsoft.AspNetCore.Components.WebAssembly.Authentication.Auth0ProviderOptions.AdditionalProviderParameters' collides with another property.
The code needs to be updated to exclude the old property from compilation on .NET 6.0 and later. I have prepared a pull request and will be submitting it shortly.
The package currently does not allow for .NET 8 support. It instead throws an NU1608 error. The project needs to be updated to support targeting the right references for the right versions.
Project.csproj: [NU1608] Detected package version outside of dependency constraint: WebAssembly.Authentication.Auth0 1.2.0 requires Microsoft.AspNetCore.Components.WebAssembly.Authentication (>= 7.0.0 && < 8.0.0) but version Microsoft.AspNetCore.Components.WebAssembly.Authentication 8.0.3 was resolved.
Hello,
I tested this nuget and found one issue. In some cases when i press logout, page reloads but im still logged in. Pressing second time only logs me out. I also tested and logging out works first time if i log in, refresh the page myself and then click logout.
Any idea what could be causing this issue?
The package currently does not allow for .NET 7 support. It instead throws an NU1608 error. The project needs to be updated to support targeting the right references for the right versions.
Hello, I have some special requirements to accept the Audience from User input, there is any way to implement it?
Failed to run Azure Pipelines as it requires this package to be supported for .net 5
##[error]The nuget command failed with exit code(1) and error(NU1202: Package WebAssembly.Authentication.Auth0 1.0.0.1 is not compatible with net50 (.NETFramework,Version=v5.0). Package WebAssembly.Authentication.Auth0 1.0.0.1 supports: netstandard2.1 (.NETStandard,Version=v2.1) NU1202: Package WebAssembly.Authentication.Auth0 1.0.0.1 is not compatible with net50 (.NETFramework,Version=v5.0) / browser-wasm. Package WebAssembly.Authentication.Auth0 1.0.0.1 supports: netstandard2.1 (.NETStandard,Version=v2.1) Errors in D:\a\1\s\FinanceManager.Client\FinanceManager.Client.csproj NU1202: Package WebAssembly.Authentication.Auth0 1.0.0.1 is not compatible with net50 (.NETFramework,Version=v5.0). Package WebAssembly.Authentication.Auth0 1.0.0.1 supports: netstandard2.1 (.NETStandard,Version=v2.1) NU1202: Package WebAssembly.Authentication.Auth0 1.0.0.1 is not compatible with net50 (.NETFramework,Version=v5.0) / browser-wasm. Package WebAssembly.Authentication.Auth0 1.0.0.1 supports: netstandard2.1 (.NETStandard,Version=v2.1)) ##[error]Packages failed to restore
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.