title: Getting 401 Unauthorized error while trying to launch Jenkins slave via command line through JNLP using -secret option
body: <p>I am trying to launch my Jenkins slave via command line through JNLP, so that I can put the command in the task scheduler. However, I am facing authentication issues only when I use the -secret option with the secret key generated by Jenkins. Works fine if I pass the -auth option with the same username password that I use for Jenkins. </p>
  
  <pre><code>java -jar slave.jar -jnlpUrl http://&lt;jenkins host&gt;:&lt;port&gt;/jenkins/computer/&lt;Slave name&gt;/slave-agent.jnlp -secret &lt;secret_key&gt; -workDir "C:\Jenkins\Robot"
  </code></pre>
  
  <p>Note: the command I try to execute is as is copied from Jenkins page.</p>
  
  <p>It gives following error:</p>
  
  <pre><code> org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDirINFO: Using C:\Jenkins\Robot\remoting as a remoting work directory Both error and output logs will be printed to C:\Jenkins\Robot\remoting Not use http_proxy property or environment variable which is invalid: unknown protocol: one.proxy.att.com Failing to obtain http://&lt;host:port&gt;/jenkins/computer/&lt;job&gt;/slave-agent.jnlp?encrypt=true
   java.io.IOException: Failed to load http://&lt;host:port&gt;/jenkins/computer/&lt;job&gt;//slave-agent.jnlp?encrypt=true: 401 Unauthorized
           at hudson.remoting.Launcher.parseJnlpArguments(Launcher.java:485)
           at hudson.remoting.Launcher.run(Launcher.java:316)
           at hudson.remoting.Launcher.main(Launcher.java:277)
   Waiting 10 seconds before retry
  </code></pre>
  
  <p>However, if I change command as follows, it runs successfully.</p>
  
  <pre><code>java -jar slave.jar -jnlpUrl http://&lt;jenkins host&gt;:&lt;port&gt;/jenkins/computer/&lt;Slave name&gt;/slave-agent.jnlp/slave-agent.jnlp -auth &lt;user&gt;:&lt;pass&gt; -workDir "C:\Jenkins\Robot"
  </code></pre>
  
  <p>I cannot keep my credentials in the launch file as this will remain in public shared repository. Pls help. </p>