We are using EWS client to access microsoft exchange mail box. It was working fine just till last week and now getting unauthorized error(401) when trying to read inbox. Here is code which is doing connect:
EWSClient.useSAAJAPI(true);
System.setProperty(“http.auth.preference”, “NTLM”);
Authenticator.setDefault(getAuthenticator(userName,password, “”));
IEWSClient client = EWSClient.getEWSClient(new URL(serverUrl));
AND
static Authenticator getAuthenticator(String user, String pw, String domain) {
final String username = domain + “\” + user;
final String password = pw;
//System.out.println("New Credentials " + username);
return new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password.toCharArray());
}
};
}
I think, we need OAUTH2 based authorization now because basic authorization is being stopped.
Please help here OAUTH2 because we purchased Aspose Email for email support to client and now its blocker in production.