title: "Safely" store (on client side) tokens for reuse?
body: <p>I'm trying to create a desktop application that will send updates to a web-service I am developing.</p>
  
  <p>Ideally, the application would be configured only once and deployed to a network share. When configuring the application, the user will enter a password that is used to authenticate within the web-service. After that, a token will be created to be used on future connections. </p>
  
  <p>This would allow any computer with access to the network share (even if it is not the computer in which the app was configured) to just run the application (which will connect to the web-service) without entering any credentials (because the token has been saved).</p>
  
  <h3>Question is: <strong>How should I protect this token?</strong></h3>
  
  <ul>
  <li>I know that storing it client-side will never be completely secure, but I want to make it as hard as possible for someone to gain access to the plaintext token.</li>
  <li>I'm looking for an answer that, preferably, does not depend on any operational-system resource (since the application can be executed from different devices).</li>
  <li>Assume I have full control over the application and the web-server</li>
  <li>I'm developing the console application using C#, but I believe this to be more of a theoretical question (not tied to any specific language)</li>
  </ul>
  
  <hr>
  
  <p>Here are a few things I've tried/thought about:</p>
  
  <ul>
  <li><p><strong>Serializing the token using something like C#'s <code>SecureString</code> and storing it on a file</strong>: it's the best I've come with. But obviously, very trivial to reverse if someone gains access to the key file.</p></li>
  <li><p><a href="https://stackoverflow.com/a/12657970/5686352">This</a> answer suggests to use the <a href="http://msdn.microsoft.com/en-us/library/ms995355.aspx" rel="nofollow noreferrer">Windows Data Protection API (DPAPI)</a> (in C#, the <a href="http://msdn.microsoft.com/en-us/library/system.security.cryptography.protecteddata.aspx" rel="nofollow noreferrer"><code>ProtectedData</code></a> class), but apparently, this would allow only the user who initially saved the credentials to access them, which would not work because I have to access the protected data from multiple users/devices.</p></li>
  <li><p><strong>Pass the token as a parameter to the application</strong>: this just changes <em>where</em> I'm going to store the token (on a batch file or OS task that calls the program, for example), but I don't think it makes it any more secure.</p></li>
  </ul>