0

Please or Register to create posts and topics.

Failed to load users

Currently using the angular material folder with npm start, the clientApp is removed. the users table has been modified to add a filed (string) in both the backend and user.model

I was able to successfully login, but when the users tab is clicked I get an error in the console

"", Error: "{"headers":{"normalizedNames":{},"lazyUpdate":null},"status":200,"statusText":"OK","url":"http://localhost:5050/account/login?returnUrl=%2Fapi%2Faccount%2Fusers","ok":false,"name":"HttpErrorResponse","message":"Http failure during parsing for http://localhost:5050/account/login?returnUrl=%2Fapi%2Faccount%2Fusers","error":{"error":{},"text":"<!DOCTYPE html>

the server had the following response (302 found for users and 304 for roles)

 IdentityServer4.Hosting.CorsPolicyProvider[0]

CORS request made for path: /api/account/users from origin: http://localhost:4200 but was ignored because path was not for an allowed IdentityServer CORS endpoint

 

could you help please...

Did you also split the IdentityServer portion from the Backent API as part of your modifications? This looks like an incorrect IdentityServer configuration.

Please follow the discussion here "https://www.staging8.ebenmonney.com/forum/?view=thread&id=27" on how to properly configure the backend to work with the Angular CLI version.

 

The identity server configuration is untouched, although i modified the profile service to include the add user field

public async Task GetProfileDataAsync(ProfileDataRequestContext context)
{
var sub = context.Subject.GetSubjectId();
var user = await _userManager.FindByIdAsync(sub);
var principal = await _claimsFactory.CreateAsync(user);
var claims = principal.Claims.ToList();
claims = claims.Where(claim => context.RequestedClaimTypes.Contains(claim.Type)).ToList();
if (user.JobTitle != null)
claims.Add(new Claim(PropertyConstants.JobTitle, user.JobTitle));
if (user.HospitalId != null)
claims.Add(new Claim(PropertyConstants.HospitalId, user.HospitalId));

Ensure the cors configurations from Startup.cs exists. These are the only cors configuration needed to run this project.
i.e.

public void ConfigureServices(IServiceCollection services)
{
    ------

    // Add cors
    services.AddCors();

    ------
}

and

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
    ------

    //Configure Cors
    app.UseCors(builder => builder
        .AllowAnyOrigin()
        .AllowAnyHeader()
        .AllowAnyMethod());

    ------
}

If these configurations are intact you can send me a stripped down version of your project for further analysis.

Startup has the same configuration

https://github.com/QadMohKuwait/QIIS2-pro/invitations

this the repo on my github

There're cyclic cascade paths in your foreign key constraints. Hence migrations and DB seeding does not work.

Please correct this and make sure db seeding actually happens. (i.e. after first run the demo data/user actually exists in the db).

 

One important thing to also note is to make sure the line 113 below from Startup.cs actually points to the address of the backend/identityserver api.

options.Authority = "http://localhost:5050/";

The cyclic cascade was managed by changing onDelete.cascade to NoAction,

I have modified the connection to connect to azure DB

Could you have a look, you dont need to build the database