I am facing a problem with converting a curl command to Java. Below is my curl

```
curl https://api.XXXX.com/authorizations \
-u john:doe -d '' \
-H 'Accept: application/vnd.drivr.v2+json' \
-H 'Content-type: application/json'

```

and I have tried the Java equivalent this way 

```
     String stringUrl = "https://api.XXXX.com/authorizations";
        URL url = new URL(stringUrl);
        URLConnection uc = url.openConnection();

        String userpass = "john" + ":" + "doe";
        //String basicAuth = "Basic " + new String(new Base64().encode(userpass.getBytes()));
        String basicAuth = "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary(userpass.getBytes("UTF-8"));

        uc.setRequestProperty("Authorization", basicAuth);
        uc.setRequestProperty("Accept", "application/vnd.drivr.v2+json");
        uc.setRequestProperty("Content-type", "application/json");

        System.out.println("url is: "+uc.getURL().toString()+" "+basicAuth);
        InputStream inputStreamReader = uc.getInputStream();

```

Its been almost 2 days straight with this. It always gives me 403 response. I am not sure where am I going wrong. Any help would be appreciated. Thanks.