otris / ews-cpp

A C++11 header-only library for Microsoft Exchange Web Services
Apache License 2.0
70 stars 30 forks source link

Authentication as application with ews-cpp #146

Closed zamazan4ik closed 4 years ago

zamazan4ik commented 5 years ago

Hello. Thank you a lot for such useful library! I have one question - is it possible with this library to authenticate on Exchange Online as application, which is registered on Azure AD? Thank you.

bkircher commented 5 years ago

Hi. Yeah, should be no problem as long as EWS is enabled. But I think you'd be the first to try.

zamazan4ik commented 5 years ago

I am a little bit disappointed how to do it - because of all examples trying to connect as user (even ews::service ctor wants user and password).

m-Schlitzer commented 5 years ago

If I understand correctly this means you want to use OAuth2 with EWS. Thats a problem. After seeing #148 and digging around a little it seems you need Azure AD Authentication Library. I have not found a C++ implementation of said library as of yet. So far the only authentication methods are basic authentication and ntlm.

kmorrissey-mersive commented 5 years ago

Is it really necessary to use specifically Azure AD Authentication, or might a more generic OAuth2 library work?

kmorrissey-mersive commented 5 years ago

Is anyone in a position to judge whether https://github.com/Microsoft/cpprestsdk has code applicable to what is needed?

zamazan4ik commented 5 years ago

Hmm... I am note sure that we really need any specific Azure AD library because at work we are working with MS Graph API ans EWS API without any special libraries for this - just HTTP requests to some endpoints and work with JWT.

Even CURL will be enough here (but I prefer more convinient and high-level libraries for making HTTP requests). I think cpprestsdk is not required here

idolum commented 4 years ago

I think, I can close this issue, as it is addresse in #148. An implementation using the client credentials flow is available (see #163). The provided example works with a given AD tenant. But the registered client needs the application permission "FullAccess". The ROPC flow will be supported as well, but will be resolved as part of #148.