I have set up an ASP.NET Core Web API where I was able to successfully configure authentication where I can post my email and password to API/login and then access API/data where it shows a 401 error if I don't authenticate first, as expected.
I then set up a Blazor WebAssembly Standalone App where everything works fine if I leave the API as anonymous but as soon as I require authentication I cannot seem to find the correct way to authenticate to the API from the client or access the existing token having already authenticated to it directly above in the same browser window.
Both apps are running over Localhost over different ports.Tutorials I have followed have included amending Program.cs, _imports.razor, Authentication.razor and installing packages but nothing has made any difference and endpoints just give a 401 error.
In the client app I also created a form to post to API/login which returns 200 if I enter the correct credentials or `401' if not but whether I authenticate correctly or not, the successful authentication is not remembered for subsequent API requests which say I am unauthenticated.
I feel like the tutorials are all covering how to build a new authentication mechanism into the client app but I only want to authenticate to the API URL and then access the other endpoints once authenticated using the same mechanism that is used
Perhaps I am going about this the wrong way but I just want to secure the information coming out of the database to the API. I have spent about 7 hours so far and seem to have got nowhere.
Any help would be really appreciated.
ThanksRobin