Click on login with Balosar project (wasm + openiddict), how to enable CORS?

315 views Asked by At

I'm running Balosar project as follow:

I edit Balosar.Client Program.cs:

    options.ProviderOptions.Authority = "https://localhost:44360/";

I run server with

dotnet run urls=https://localhost:44360

I run client with

dotnet run

I connect a browser to https://localhost:44310, according to launchSetings.json of client project.

When I click on Log In in the browser I get the following in network console: enter image description here

and the following message in the browser:

There was an error trying to log you in: 'Network Error'

The server gets the https://localhost:44360/.well-known/openid-configuration request and sends the response (I can read it in the console), but the response never reaches the client.

I think I have to configure CORS, but I don't know where.

1

There are 1 answers

1
Henk Holterman On BEST ANSWER

That Balosar project is set up with the Hosted template.

It ought to work when you just start the Server project (not the Client) and point a Browser at the Server URL. When the Client is served by the Server you don't need CORS.

When you want to launch the client form somwhere else you need to add CORS settings in the Server project.