title: Why does my jsreport Authentication wasn't working?
body: <p>I'm trying <a href="https://jsreport.net/learn/authentication" rel="nofollow noreferrer">https://jsreport.net/learn/authentication</a>:</p>
  
  <pre><code>....
    "extensions": {
      "authentication": {
        "cookieSession": {
          "secret": "&lt;your strong secret here&gt;"
        },
        "admin": {
          "username": "admin",
          "password": "password"
        },
        "enabled": true
      },
  ......
  </code></pre>
  
  <p>I've also read the following:</p>
  
  <blockquote>
    <p>You need to add the header to every request when is this extension enabled.</p>
    
    <p>Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==</p>
    
    <p>Where the hash is based on username and password: base64(username:password)</p>
  </blockquote>
  
  <p>I tried using both <code>QWxhZGRpbjpvcGVuIHNlc2FtZQ==</code> and using <a href="https://www.motobit.com/util/base64-decoder-encoder.asp" rel="nofollow noreferrer">https://www.motobit.com/util/base64-decoder-encoder.asp</a> to encode: <code>admin:password</code> resulting: <code>YWRtaW46cGFzc3dvcmQ=</code>. Which when tried both of them doesn't seem to enable me to access my API.</p>
  
  <p>(note that key in the following was either of the above I've tried)</p>
  
  <p>I've tried placing on front-end call to jsreport API:  <code>return this.http.post(this.hosturl, parameter, { headers:  'Content-Type': 'application/json', 'Authorization': 'Basic ' + this.key }, responseType: 'blob' });</code> </p>
  
  <p>I've also tried placing on the back-end to call jsreport API:    </p>
  
  <pre><code> var data = {
          headers: {
              "Authorization" : "Basic key" 
          },
          template: { "shortid": shortid },
          options: {
              preview: preview
          }
      }
  </code></pre>
  
  <p>Any idea why it always returns unauthorized on front-end(angular) and prompting login on the back-end (express)?</p>
  
  <p><sub>PS: on backend-API prompt of username: admin and password: password doesn't work for some reason.</sub></p>
  
  <p>I only managed to log-in from the jsreport studio using the username:admin and password:password.</p>
  
  <p>Any idea is appreciated.</p>