fullstackhero / blazor-wasm-boilerplate

Clean Architecture Boilerplate Template for .NET 6.0 Blazor WebAssembly built for FSH WebAPI with the goodness of MudBlazor Components.

Home Page:https://fullstackhero.net/blazor-webassembly-boilerplate/general/getting-started/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot login using administrator credentials

Sarmadjavediqbal opened this issue · comments

I cannot login using administrator credentials. Following is a screenshot of the error I am getting after trying to login.

image

what am I missing? How the web-api and blazor-wasm communicate together???

Have you started both the backend and the frontend project?

Have you started both the backend and the frontend project?

Yes I did. both projects were running.

Have you started both the backend and the frontend project?

Any solution?? por favor...

What did you see in the log? Could you see that the request was handled by the web-api backend project?
The 404 indicates that the blazor app could not find the endpoint.

What did you see in the log? Could you see that the request was handled by the web-api backend project? The 404 indicates that the blazor app could not find the endpoint.

You are right. The logger in web-api did not log any event. But I need to know the reason why it is not communicating with the backend. path for blazor is set in CORS in backend. Do I need set path for backend in blazor-wasm ???

You can check if you can access Swagger by this url: localhost:5001/swagger
I believe CORS and paths should already be configured.

For simplicity you could also install postman, or if you have it, open the postman collection and test the API.

Swagger is running with backend. Do I need to put web-api and blazor-wasm in same solution??

Perfect.

Once the Server is up and running, like any other Blazor application, simply navigate to the Host folder under the source folder of the Blazor Project (\src\Host) and run the following standard commands.

dotnet restore
dotnet build
dotnet run
Once the build process is complete, the application would be reachable by accessing https://localhost:5002 on your browser.

By default, the API Server is set to be running on port 5001 of your local machine. If for some port related reason, you have to run the API on another port or so, navigate to src\Client\wwwroot\appsettings.json of the Blazor Project and change the API Base URL Property and set the value to the port that’s exposing the API. This is the default configuration "ApiBaseUrl": "https://localhost:5001/".

Similarly, the Blazor Project by default is set to run on port 5003 of your local machine. Incase you change this to something else, ensure that you have updated the cors.json configuration file on your API project. This makes sure that there is no CORS related issues while the Blazor project tries to access the API Endpoints.

https://fullstackhero.net/blazor-webassembly-boilerplate/general/getting-started/

Perfect.

Once the Server is up and running, like any other Blazor application, simply navigate to the Host folder under the source folder of the Blazor Project (\src\Host) and run the following standard commands.

dotnet restore dotnet build dotnet run Once the build process is complete, the application would be reachable by accessing https://localhost:5002 on your browser.

By default, the API Server is set to be running on port 5001 of your local machine. If for some port related reason, you have to run the API on another port or so, navigate to src\Client\wwwroot\appsettings.json of the Blazor Project and change the API Base URL Property and set the value to the port that’s exposing the API. This is the default configuration "ApiBaseUrl": "https://localhost:5001/".

Similarly, the Blazor Project by default is set to run on port 5003 of your local machine. Incase you change this to something else, ensure that you have updated the cors.json configuration file on your API project. This makes sure that there is no CORS related issues while the Blazor project tries to access the API Endpoints.

https://fullstackhero.net/blazor-webassembly-boilerplate/general/getting-started/

All settings are already set as mentioned. but the frontend is still not communicating with the backend.

Can you check in chrome developer tools what address your Blazor app is trying to call?
Developer Tools > Network

image

I think it is trying to access default path.

How to set custom path in blazor-wasm for web-api???

I have set custom route in my web-api as [Route("RootsAdminSvc/v{version:apiVersion}/[controller]")]. Is this the reason why frontend can not authenticate and login????

I have set custom route in my web-api as [Route("RootsAdminSvc/v{version:apiVersion}/[controller]")]. Is this the reason why frontend can not authenticate and login????

This was actually the problem. I successfully logged in just by changing the route in FSHApi.cs in Blazor-wasm. Thanks @MikaelHild.