问题
I want to build 2 apps.
- Private API in .NET that takes care of database access / processing of data.
- Blazor WebAssembly app which will connect to this API securely, to search data.
Since Blazor WebAssembly DLLs can be decompiled, I can't use any private/secret keys in the APP. I don't want anyone being able to use the API if they discover the endpoints. Only the Blazor APP can use the API (and any other app I might build in the future).
How should I approach this? Is it even possible to do it securely or should I go Server Side?
回答1:
Secure ASP.NET Core Blazor WebAssembly explains how to secure a Blazor WASM app
Blazor WebAssembly 3.2.0 Preview 2 release now available explains how to use IAccessTokenProvider
to get the access token to authentify your applicaton on API.
来源:https://stackoverflow.com/questions/61210462/blazor-webassembly-how-to-securely-consume-private-restricted-api