'How do I hide API Keys in Blazor Web Assembly
How can I hide my API Keys stored in appsettings.json as I initialize in Git?
Solution 1:[1]
@Leandro thank you for the suggestion. I however figured out secrets.json is a safer place to host the secrets securely (though locally) and that fixed my problem.
Solution 2:[2]
You need to implement config. files. You will have a web.config file in your project and in this one you put the following inside < configuration >:
<appSettings file="hiddenappsettings.config"></appSettings>
Then you create a hiddenappsettings.config file and you do the following:
<appSettings>
<add key="APIKey" value="YourApiKeyValue" />
</appSettings>
To acces you will need to use Configuration Manager to access to that key
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Kirk |
| Solution 2 | Leandro Toloza |
