title: Authorization in Sonar REST/Web API
body: <p>I have <strong>migrated</strong> my Sonar version from <strong>5.4</strong> to <strong>6.3.1</strong>.
  In 5.4 version, there was no login API provided by Sonar.
  Hence we were adding an Authorization header in every call with value as Base64 encoded "username":"password".</p>
  
  <p><strong>But post migration to 6.3.1, the authorization fails with current implementation.</strong></p>
  
  <p>We tried passing token (generated from UI) as value of Authorization header but in vain.</p>
  
  <p>We also tried calling Sonar login API (api/authentication/login) but it is not giving back any response.</p>
  
  <p>Kindly help us resolve this issue.</p>
  
  <p>Thanks.</p>
  
  <p><strong>Edit</strong></p>
  
  <p>Following is the code for calling REST Webservice:</p>
  
  <pre><code>byte[] encodedUsernamePassword = Base64.getEncoder().encode("adminUserName:adminPassword".getBytes());
  
  ResteasyClient client = new ResteasyClientBuilder().build();
      String target = "http://IP:Port/api/issues/search/?statuses=" + "CLOSED" + "&amp;assignees=" + username + "&amp;resolutions=" + "FIXED" + "&amp;createdBefore=" + end_date + "&amp;createdAfter=" + start_date + "&amp;facetMode=debt";
  
  javax.ws.rs.core.Response response = client.target(target).request(MediaType.APPLICATION_JSON).header("Authorization", new String(encodedUsernamePassword)).get();
  
  String strResponse = response.readEntity(String.class);
  </code></pre>