I'm using Identity Server 4 to provide a token access to an API. I'm setting up my client code; which looks something like this:
var disco = await _httpClient.GetDiscoveryDocumentAsync(new DiscoveryDocumentRequest
{
Address = "https://indentityserveraddress.com",
Policy =
{
ValidateIssuerName = false
}
});
var response = await _httpClient.RequestClientCredentialsTokenAsync(new ClientCredentialsTokenRequest
{
Address = disco.TokenEndpoint,
ClientId = "client",
ClientSecret = "secret",
Scope = "api1"
});
If this were a web application, I could simply store the secret in the web.config, read it from there and supply it to Identity Server. However, this call is from a UWP client.
My question is: what strategies are there when using a desktop client to secure this secret? If it's just in plain text the assembly could easily be put through DotPeek or ILDasm or something similar and storing it in a config client on the client makes that problem even worse. I can't store it on the server, because I would need to be authenticated in order to access it (catch-22).