Uploaded image for project: 'Bitbucket Cloud'
  1. Bitbucket Cloud
  2. BCLOUD-2721

Add a www-authenticate header to our response (BB-1692)

    XMLWordPrintable

Details

    Description

      Authentication failed.

      • Java 1.6
      • httpcore-4.1.jar
      • httpclient-4.1.1.jar

      Server require an authentication and return 401 status code.
      But server dont tell client to which authentication scheme is needed.

      Sample Code
      {{{
      #!java

      DefaultHttpClient httpclient = new DefaultHttpClient();
      try {
      HttpGet httpget = new HttpGet("https://api.bitbucket.org/1.0/repositories/shuji.w6e/receipt-box/issues/");
      httpclient.getCredentialsProvider().setCredentials(new AuthScope("api.bitbucket.org", 443),
      new UsernamePasswordCredentials("shuji.w6e", "********"));
      HttpResponse response = httpclient.execute(httpget);
      HttpEntity entity = response.getEntity();
      System.out.println(response.getStatusLine());
      if (entity != null) {
      System.out.println("Response content length: " + entity.getContentLength());
      }
      EntityUtils.consume(entity);
      } finally {
      httpclient.getConnectionManager().shutdown();
      }
      }}}
      Server response is not contains "WWW-Authenticate" header.
      Please append a header suche as "WWW-Authenticate: Basic realm="Authentication required".

      Attachments

        Activity

          People

            Unassigned Unassigned
            legacy-bitbucket-user Legacy Bitbucket Cloud User (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: