HttpURLConnection Request to the 1c web service with a login from android

enter a description of the image here I made a request to the 1c web service, it has an authorization window, how do I send my username and password along with the request? Is there any method for transmitting the username and password?

             httpURLConnection = (HttpURLConnection) url.openConnection();
            httpURLConnection.setRequestMethod("GET");
            httpURLConnection.setReadTimeout(1000);
            httpURLConnection.setConnectTimeout(1000);
            httpURLConnection.connect();
Author: ЮрийСПб, 2019-11-05

1 answers

    String userpass = username + ":" + password;
    String auth = "Basic " + Base64.encodeToString(userpass.getBytes(), Base64.NO_WRAP);

    httpURLConnection = (HttpURLConnection) url.openConnection();
    httpURLConnection.setRequestMethod("GET");
    httpURLConnection.setReadTimeout(1000);
    httpURLConnection.setConnectTimeout(1000);
    httpURLConnection.setRequestProperty("Authorization", auth);
    httpURLConnection.connect();
 1
Author: Vitaly Tomashevsky, 2019-11-07 06:54:51