How can I hide my API Keys stored in appsettings.json as I initialize in Git?
How do I hide API Keys in Blazor Web Assembly
821 views Asked by Kirk At
2
There are 2 answers
0
On
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
@Leandro thank you for the suggestion. I however figured out
secrets.jsonis a safer place to host the secrets securely (though locally) and that fixed my problem.