Since I can't open the link you posted, the analysis of the 401 error may be incorrect.
Because the request does not contain an Authorization header, the server returns a 401 to the client and adds information to the header of response "www-authentivate". When the client encodes the username and password with Base64 encryption and sends it to the server in the Authorization header, the authentication will be successful.
Recently, I also encountered a 401 error with postman, which is when requesting the user's token interface, all Body request parameters and headers are the same, but it is an error 401. Forgot to add the request header of Authorization. The solution is to add key-value pairs for basic authentication in the headers
Here is my sample, when using HttpPost to log in for authentication, the username and password are placed in the request header in the form Authorization: username password.
public static User getUserData(String url,String userName,String userPass){
//1.create HttpClient
try {
BasicHttpParams httpParams = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(httpParams, 20 * 1000);
HttpConnectionParams.setSoTimeout(httpParams, 20 * 1000);
DefaultHttpClient client = new DefaultHttpClient(httpParams);
HttpPost post = new HttpPost(url);
post.setHeader("Content-Type", "application/json");//The main thing here is to figure out what your token is, pass the authentication information correctly, and this authentication information is determined by the username and password
//use base64 encrypt
byte[] tokenByte = Base64.encodeBase64((userName+":"+userPass).getBytes());
//turn to string
String tokenStr = DataTypeChange.bytesSub2String(tokenByte, 0, tokenByte.length);
//Basic YFUDIBGDJHFK78HFJDHF== token
String token = "Basic "+tokenStr;
//sent message to header
post.setHeader("Authorization", "Basic "+token);
HttpResponse response = client.execute(post);
int statusCode = response.getStatusLine().getStatusCode();
String retSrc = EntityUtils.toString(response.getEntity(), "utf-8");
Log.i("Tag", "url=="+url);
Log.i("Tag", "===statuscode==="+statusCode+"===retsrc==="+retSrc);
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
Some log in by passing usernames and passwords through post JSON data.
You can also authenticate the login via HttpGet, in which case the URL contains the username and password information.
==============================================================================
As for providing credentials, it is recommended to check the relevant documentation from Microsoft:
https://learn.microsoft.com/en-us/windows/win32/secauthn/credential-providers-in-windows