0
votes

When Migrating API from 2.2 .NET Core to 3.0 i am facing error with the below code when running the API.

public static void Configure(IApplicationBuilder app)

{

app.UseCors(builder => builder

                  .WithOrigins(ConfigurationSettings.CORSAllowedSites)
                  .AllowAnyMethod()
                  .AllowAnyOrigin()
                  .AllowAnyHeader()
                  .AllowCredentials()
                  );

}

**Error:The CORS Protocol does not allow specifying a wildcard origin and credentials at the same time. Configure Cors policy by listing individual origins if credentials need to be supported **

1

1 Answers

2
votes

Remove .AllowCredentials() from the app.UseCors method, like this:

  app.UseCors(builder => builder
                      .WithOrigins(ConfigurationSettings.CORSAllowedSites)
                      .AllowAnyMethod()
                      .AllowAnyOrigin()
                      .AllowAnyHeader()
                      );