'Auth2 implementation for JAVA EWS existing project

I am new to auth2 implementation for Microsoft Exchange service and I want to implement the same in existing process Login Process. Previously we are using Username password technique to create EWS object. Now I want to update existing Username and Password technique with Auth2 Process.

As of now I have try to used Graph API to Generate Access Code using below link

https://docs.microsoft.com/en-us/graph/tutorials/java

But Facing issue: The request body must contain the following parameter: 'client_assertion' or 'client_secret'.

Using another library as below for auth2

https://github.com/AzureAD/microsoft-authentication-library-for-java/wiki

This library also facing some issue like Collection$Singleton object not able to cast java.lang.String

While passing scope

Please suggest me some sample for to implement the AUTH2 implementation for the EWS in java.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source