calcom / cal.com

Scheduling infrastructure for absolutely everyone.
https://cal.com
Other
31.46k stars 7.62k forks source link

[CAL-643] Adding Exchange app fails - calendly works :/ #5312

Closed dkgrieshammer closed 7 months ago

dkgrieshammer commented 1 year ago

Adding exchange connector app fails with 401 on cal.com (free web version); Also tried outlook connector and legacy exchange apps multiple times, don’t work either. Adding the same exchange/credentials to Apple calendar, fantastical, (calendly just to test connector :) is working fine.

I realize that only cal.com requires full path of echange server asmx file, others just use owa.tld.com (guess that means they have auto-discovery?)

University Admin desk couldn’t help either since it’s working fine with all other services it seems to be a problem in cal.com‘s connector? Any help or hint much appreciated 🙏😚

CAL-643

milospuac commented 1 year ago

Hi there, thanks for flagging this. Our team will investigate the issue

kopfpolster commented 1 year ago

Hi! I have the same issue. calendly uses owa.tld.com and it works. Im Using Exchange 2016 Server. Thank you for investigating.

rimkov commented 1 year ago

hi! i have the same issue with our local exchange server 2019. calendso (3.15.2) receive a 401 unathorized error. thank you for your support.

RiRe commented 1 year ago

Same problem here

saschaschworm commented 1 year ago

Hi. I authored this integration and it works fine with Microsoft Exchange Server 2016 (15.1.2507.16) using Cal.com 2.3.5 on-premises. Exchange on-premises servers (like the one used by the university I work for) often have basic authentication disabled and require NTLM. Have you tried this? Either with gzip compression enabled or disabled?

dkgrieshammer commented 1 year ago

Hi Sascha, yes I tried all options, also on multiple days and cross checked with calendly to be sure it’s not a hiccup on our servers side.Thanks for your work on this btw 👏

saschaschworm commented 1 year ago

I guess I overfitted this integration to work fine with the Exchange on-premises server I'm currently using but failed to generalize it to other possible scenarios. Hard to debug though because configurations vary across servers and I can only access one specifically. However, I'll refactor this integration to make use of the Autodiscover Service and to match the on-boarding process to the one users are more familiar with. Want to assign me to this issue, @PeerRich?

PeerRich commented 1 year ago

sure go for it!

dkgrieshammer commented 1 year ago

I guess I overfitted this integration to work fine with the Exchange on-premises server I'm currently using but failed to generalize it to other possible scenarios. Hard to debug though because configurations vary across servers and I can only access one specifically. However, I'll refactor this integration to make use of the Autodiscover Service and to match the on-boarding process to the one users are more familiar with. Want to assign me to this issue, @PeerRich?

Happy to test and provide feedback; also I think there is an exchange dev-instance from Microsoft mentioned in those docs if I remember correctly. I just had a brief look, I'm quite ok with coding but not familiar with obsidian plugins nor exchange API but can read a console and hand in connection errors :)

RiRe commented 1 year ago

@saschaschworm Any news? You use ews-javascript-api, we want to connect to IONOS exchange accounts. We were unable to establish a connection using this library, while we can access https://exchange2019.ionos.de/Ews/Exchange.asmx with the web browser. Credentials are requested with Basic authentication.

saschaschworm commented 1 year ago

@RiRe Progress is slow due to work commitments, but I'm on it. So far I have implemented the autodiscovery process which I hope will provide some help in configuring the adapter correctly. However, it is difficult to test my code since I don't have access to other Exchange configurations and I somewhat lack the time to set up various test environments.

So if you can provide logs from your attempts (I understand correctly that you tried it directly through the ews-javascript-api and not Cal.com?) or even a limited test account on your Exchange server, that would be fantastic. Until I can test the connection setup with other Exchange servers, a PR is probably too early.

RiRe commented 1 year ago

@saschaschworm I can send you test credentials, please give me your mail address.

saschaschworm commented 1 year ago

@RiRe Thanks again for providing me test credentials. It really helps to have an alternative Exchange server to test some things. However, I found that the current integration indeed works with the server you are using. Would you kindly try it again and select NTLM as authentication method and enable gzip?

RiRe commented 1 year ago

@saschaschworm I definitely tried all possible configurations before and it did not work. However, I tried it again with my account today and everything went well. I am just curious about why it works now (in the meantime, we kept cal.com up-to-date). Thank you for pointing that out!

dkgrieshammer commented 1 year ago

@saschaschworm thanks for taking that on and for the connector in general :) For me the problem remains, I just tried the Exchange Connector once more with and without NTLM and gzip; I also gave the 2016 and 2013 Connectors a try, same result, I always get an error. I'm happy to test and provide feedback or console.logs if that's of any help. 🙏

image
RiRe commented 1 year ago

@dkgrieshammer For me, the original errors were "401 Unauthorized" and "Cannot add this exchange account". We also tried all connectors and options. Happy to see it working now but no clue about the reason. What provider/setup do you use? It is necessary to give full URI to Exchange.asmx, just to make sure.

dkgrieshammer commented 1 year ago

Thanks, I’m aware of fullpath requirement as already said when opening this issue. This requirement in the cal connector might be part of the issue (as discussed) since calendly uses auto discovery and also exchange api doc examples promote AD.

saschaschworm commented 1 year ago

@dkgrieshammer Would you please use https://testconnectivity.microsoft.com/tests/Ola/input and share the output with me (after the analysis, there is a button in top-right corner that lets you export the result as a HTML file)? The output does not contain any credentials. For the Domain\Username (or UPN) field, please use your email address.

dkgrieshammer commented 1 year ago

Hi Sascha, happy 2023; I've emailed you the html-log; thanks a lot for looking into this 🙏

saschaschworm commented 1 year ago

Happy 2023, David! The log file will really help to sort some things out. What is the URL pointing to the Exchange.asmx file you tested the Cal.com integration with?

kopfpolster commented 1 year ago

@RiRe Progress is slow due to work commitments, but I'm on it. So far I have implemented the autodiscovery process which I hope will provide some help in configuring the adapter correctly. However, it is difficult to test my code since I don't have access to other Exchange configurations and I somewhat lack the time to set up various test environments.

So if you can provide logs from your attempts (I understand correctly that you tried it directly through the ews-javascript-api and not Cal.com?) or even a limited test account on your Exchange server, that would be fantastic. Until I can test the connection setup with other Exchange servers, a PR is probably too early.

i can test the autodiscovery process, if needed. thank you for your work! happy 2023!

PeerRich commented 1 year ago

the Exchange app is a bit out of our expertise. would rely on some community contributions ❤️

copoer commented 1 year ago

Howdy, I found that once I changed the exchange server version I was able to connect to AWS WorkMail. Specific issue here: https://github.com/calcom/cal.com/issues/7901.

I created a PR that adds the ability to select: https://github.com/calcom/cal.com/pull/7908 Testing of this PR would be welcomed as I would like it merged in quickly. This may solve the issue in other cases as well.

PeerRich commented 1 year ago

seems to be fixed!

dkgrieshammer commented 1 year ago

@PeerRich no it's not, I just tested the connection. copoer added selector and is able to connect to AWS WorkMail but the original issue remains. I still think Calendly is doing it via MS current suggested way of autodiscovery. Please re-open!

dkgrieshammer commented 1 year ago

So since @PeerRich doesn't respond I open the same Problem as another Issue? Closing issues without consent from the issuer doesn't motivate to contribute or report that much tbh.

PeerRich commented 1 year ago

reopening, sorry i missed your last reply, lots of moving pieces for 3.0 and 3.1!

rimkov commented 1 year ago

the initial issue is still there, i tried with Exchange Web Services (EWS). here is my logs if it can help

@calcom/web:start: 13:06:33.418 ERROR Could not add this exchange account 
@calcom/web:start: SoapFaultDetails {
@calcom/web:start:   message: '401 Unauthorized',
@calcom/web:start:   stack: 'Exception: 401 Unauthorized\n' +
@calcom/web:start:     '    at FindFolderRequest.ProcessWebException (/opt/calendso/tmp/new/calendso/node_modules/ews-javascript-api/js/Core/Requests/ServiceRequestBase.js:290:36)\n' +
@calcom/web:start:     '    at /opt/calendso/tmp/new/calendso/node_modules/ews-javascript-api/js/Core/Requests/SimpleServiceRequestBase.js:65:40\n' +
@calcom/web:start:     '    at runMicrotasks (<anonymous>)\n' +
@calcom/web:start:     '    at processTicksAndRejections (node:internal/process/task_queues:96:5)\n' +
@calcom/web:start:     '    at FindFolderRequest.ProcessWebException (/opt/calendso/tmp/new/calendso/node_modules/ews-javascript-api/js/Core/Requests/ServiceRequestBase.js:290:36)\n' +
@calcom/web:start:     '    at /opt/calendso/tmp/new/calendso/node_modules/ews-javascript-api/js/Core/Requests/SimpleServiceRequestBase.js:65:40\n' +
@calcom/web:start:     '    at runMicrotasks (<anonymous>)\n' +
@calcom/web:start:     '    at processTicksAndRejections (node:internal/process/task_queues:96:5)',
@calcom/web:start:   InnerException: null,
@calcom/web:start:   faultCode: null,
@calcom/web:start:   faultString: null,
@calcom/web:start:   faultActor: null,
@calcom/web:start:   responseCode: 127,
@calcom/web:start:   errorCode: 0,
@calcom/web:start:   exceptionType: null,
@calcom/web:start:   lineNumber: 0,
@calcom/web:start:   positionWithinLine: 0,
@calcom/web:start:   errorDetails: DictionaryWithStringKey {
@calcom/web:start:     keys: [],
@calcom/web:start:     keysToObjs: {},
@calcom/web:start:     objects: {},
@calcom/web:start:     keyPicker: [Function (anonymous)]
@calcom/web:start:   },
mynymp commented 1 year ago

Since my provider upgraded my (hosted) Exchange account to version 2019, I can no longer connect my calendar to cal.com. Here the diagnosis of my provider's support team:

Cal.com uses Basic-Auth as authentication. This is disabled in Exchange 2019 for EWS for security reasons. The test with NTLM Auth for EWS results in the error message: "0308010c:digital envelope routines::unsupported", which suggests a problem at cal.com. The error is probably caused when software written in React does not support the appropriate openssl providers. This is for example the case since version 17. Say: This EWS connector at cal.com does not support Exchange 2019

I was directed to this thread by the cal.com support. As this issue renders cal.com unusable for me, I am curious to learn if there is a chance it will be solved in the near future, so I can decide if I need to leave cal.com and switch to another service instead.

Thanks for a brief orientation.

dkgrieshammer commented 1 year ago

Apparently this extension is using EWS with basic auth which is deprecated as of now. While it's possible to switch EWS to OAuth Microsoft suggests to use Graph for future dev. I'm not the dev of this extension and not really fluent in Microsofts API stuff so I don't think I can fix it myself. My feeling is, if the nice core cal team is not behind the main calendar provider integration, it's more or less a gamble on availability of os devs (thanks for your work btw :) ). I'm willing to pay for reliability since I need the integration to be running, so as much as I love cal.com I will switch to calendly for the time beeing. Hope this gets resolved and rewarded some day 🙏

mynymp commented 1 year ago

There is no connection possible to MS Exchange above version 2019. The reply from the support team on this issue: This integration was built by the community and it looks like we need to do a complete rehaul. Sorry about that I switched to Calendly for the time being, hoping to be able to return one day...

icsy7867 commented 1 year ago

This a blocker for us as well :(

kopfpolster commented 1 year ago

is there some kind of roadmap for fixing this bug? i‘m in a volunteer organisation, deciding where to go thank you for your work

keithwillcode commented 7 months ago

We've decided to postpone work on this because of the investment of getting Exchange on prem is high. Using Exchange online is currently working with our current Outlook integration.