OAuth2 for Exchange server 2013, 2016 and Office 365
<p>Can anyone help me on how do I connect to Exchange server (need to connect to 2013, 2016 and Office 365 based on the user account) and get the emails of a User in that Exchange server via OAuth2?
I have gone through few articles describing it 
Here are the list of them
1. <a href="https://azure.microsoft.com/en-us/documentation/articles/active-directory-authentication-scenarios/" rel="nofollow">https://azure.microsoft.com/en-us/documentation/articles/active-directory-authentication-scenarios/</a>
2. <a href="https://msdn.microsoft.com/en-us/library/office/dn626019(v=exchg.150).aspx" rel="nofollow">https://msdn.microsoft.com/en-us/library/office/dn626019(v=exchg.150).aspx</a>
But I'm bit confused, as those articles are implying different procedures to implement for Exchange 2013, 2016 and Office 365.
I needed a "Client Credential Flow" of OAuth2 to connect to them. But I wanted to have a Single server to server application which can talk to 2013, 2016 and Office 365</p>

<p>Thank you</p>