Hi all, I’m following this article ASP.NET Core + VueJS
I have a registered Single Page App in React.
I have a registered API, applied to my .net core backend.
I’m correctly logging with the Single Page Application, but when I’m calling the .net core backend, in the log, appear this error:
Bearer was not authenticated. Failure message: IDX10214: Audience validation failed. Audiences: 'https://dataof.eu.auth0.com/api/v2/, https://dataof.eu.auth0.com/userinfo'. Did not match: validationParameters.ValidAudience: 'https://elsoftskeleton.com' or validationParameters.ValidAudiences: 'null'.
The flow of app is this:
-
The SPA is logged in to Auth0 and in my local storage there is the access token
-
From the SPA, I’m calling my backend in .net core that has also the implementation of the [Authorize] decorator of Auth0 logics.
-
The .net core is not authenticating me for the reason that I wrote before.
Is there a way to solve this problem?
This is the part of .net core backendstring domain = $"https://{Configuration["Auth0:Domain"]}/"; services.AddAuthentication(options => { options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; }).AddJwtBearer(options => { options.Authority = domain; options.Audience = Configuration["Auth0:ApiIdentifier"]; });
Thank you