Coder Social home page Coder Social logo

stefh / blazor.webassembly.authentication.auth0 Goto Github PK

View Code? Open in Web Editor NEW
11.0 11.0 6.0 36 KB

Blazor WebAssembly Auth0 Oidc Authentication with support for Audience

License: MIT License

C# 93.94% Batchfile 6.06%
auth0 authentication blazor oidc webassembly

blazor.webassembly.authentication.auth0's Introduction

Hi ๐Ÿ‘‹, I'm Stef Heyenrath

stefh

  • ๐Ÿ”ญ Iโ€™m currently working on WireMock.Net
  • ๐ŸŒฑ Iโ€™m currently learning more Azure and Blazor

Environments

windows azure docker linux

Languages

csharp dotnet nodejs javascript typescript

Frontends

blazor angularjs vuejs bootstrap html5 chartjs

stefh

stefh

mr62rashy

blazor.webassembly.authentication.auth0's People

Contributors

robertmclaws avatar stefh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

blazor.webassembly.authentication.auth0's Issues

client_secret

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

How to use POST?

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.

Broken on .NET 6.0

Problem

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.

Symptoms

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.

Solution

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.

.NET 8 Support

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.

Logout does not work every time

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?

.NET 7.0 Support

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.

.net 5 support

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.