Git Product home page Git Product logo

Comments (16)

bfredo123 avatar bfredo123 commented on June 2, 2024

Investigating further on the 'CreateItem' request sent, I could find some differences in the headers:

  • The C# working version has no "Authoriszation: ' Basic ..." header (and the Node one has one), and no 'Accept' nor 'Accept-Encoding' headers
  • The C# working version also has much more headers:
HTTP/1.1 200 OK
Cache-Control: private
Transfer-Encoding: chunked
Vary: Accept-Encoding
Server: Microsoft-IIS/10.0
request-id: 783e106b-af4a-4b4b-807e-d25aa6dca657
X-CalculatedBETarget: dag3ex1.indiv4.local
Strict-Transport-Security: max-age=31536000; includeSubDomains, max-age=31536000; includeSubDomains
X-DiagInfo: DAG3EX1
X-BEServer: DAG3EX1
X-AspNet-Version: 4.0.30319
Set-Cookie: exchangecookie=42xxx; expires=Tue, 02-Jan-2024 10:29:08 GMT; path=/; HttpOnly, X-BackEndCookie=S-1-5-21-1840533827-1334025008-xxx-90715=xxx/N0s/Oq87Pxc3Gxc/HgZaRm5aJy9GTkJyek4HP; expires=Wed, 01-Feb-2023 10:29:08 GMT; path=/ews; secure; HttpOnly
Persistent-Auth: true
X-Powered-By: ASP.NET
X-FEServer: CAS7
Date: Mon, 02 Jan 2023 10:29:08 GMT
Content-Encoding: gzip

Any clue to make my Node app work?
Many thanks!

from ews-javascript-api.

bfredo123 avatar bfredo123 commented on June 2, 2024

Am I the only one have this issue? If anyone has any clue, even if it's not a solution, I would greatly appreciate any feedback: it might help me to find what to look after, to fix it.
Big thank you in advance!

from ews-javascript-api.

cimchd avatar cimchd commented on June 2, 2024

Same problem here, but no solution yet...

from ews-javascript-api.

bfredo123 avatar bfredo123 commented on June 2, 2024

Thanks Cimchd, I feel less alone.

from ews-javascript-api.

gautamsi avatar gautamsi commented on June 2, 2024

Have you tried to find out if you need NTLM auth or basic auth? Check with your exchange admin. This library does not have built in Windows NTLM auth you have to use it separately

from ews-javascript-api.

bfredo123 avatar bfredo123 commented on June 2, 2024

Thank you Gautamsi, the C# code above works. Could it work if NTLM is required?

from ews-javascript-api.

gautamsi avatar gautamsi commented on June 2, 2024

yes, c# runs on windows and it can choose between NTLM or not, but you have to know beforehand with this lib and use https://github.com/ewsjs/xhr to setup NTLM.

from ews-javascript-api.

bfredo123 avatar bfredo123 commented on June 2, 2024

Thank you so much, will give a try (I have zero skills on ntlm, hope I won't be stuck due to this)

from ews-javascript-api.

bfredo123 avatar bfredo123 commented on June 2, 2024

Great news, thanks to the xhr package I could make it work, thank you again!

Now, I would like to use the autodiscover, but it does not work:

const ews = require("ews-javascript-api")
var ewsAuth = require("ews-javascript-api-auth");
ews.ConfigurationApi.ConfigureXHR(new ewsAuth.ntlmAuthXhrApi(user.email, user.password));

var autod = new ews.AutodiscoverService(new ews.Uri("https://autodiscovers.outlook.com/autodiscover/autodiscover.xml"), ews.ExchangeVersion.Exchange2010_SP1);
autod.Credentials = new ews.WebCredentials(user.email, user.password);
var settings = [
    ews.UserSettingName.InternalEwsUrl,
    ews.UserSettingName.ExternalEwsUrl,
    ews.UserSettingName.UserDisplayName,
    ews.UserSettingName.UserDN,
    ews.UserSettingName.EwsPartnerUrl,
    ews.UserSettingName.DocumentSharingLocations,
    ews.UserSettingName.MailboxDN,
    ews.UserSettingName.ActiveDirectoryServer,
    ews.UserSettingName.CasVersion,
    ews.UserSettingName.ExternalWebClientUrls,
    ews.UserSettingName.ExternalImap4Connections,
    ews.UserSettingName.AlternateMailboxes
];
autod.GetUserSettings([user.email], settings)
    .then(function (response) {
      //do what you want with user settings    
    }, function (e) {
      console.error("autod error", e)
    });
}

When I run this, I get: autod error undefined

I have tried some variants, but no luck. Do you know what is wrong here?
Many thanks

from ews-javascript-api.

bfredo123 avatar bfredo123 commented on June 2, 2024

Softly asking again in case my last question was skipped :) Many thanks again for the help provided already!

from ews-javascript-api.

gautamsi avatar gautamsi commented on June 2, 2024

Autodiscover may not work with NTLM, in case you are using NTLM you can provide direct URL to ews.

in this example, you have already provided url so it is not going to autodiscover anything

from ews-javascript-api.

bfredo123 avatar bfredo123 commented on June 2, 2024

Thank you very much Gautamsi! Do you refer to the code example I gave on February 3rd? The only URL it provides is one for autodiscovery (autodiscovers.outlook.com/...), so I don't understand why you say it is not going to autodiscover anything.

Regarding NTLM, autodiscovery works with the C# code I have provided on January 2nd, so I suspect the reason of failure is not NTLM, do you agree? Or do you mean that the autodiscover implementation of the ews-javascript-api node package does not work with NTLM?

One more hint: I have tried with a 3rd party tool (Calendly) that by giving only the email address and the password, it was able to connect to that specific account, so the autodiscovery has worked in that case too.

Many thanks in advance for any further help! I would love so much to offer autodiscovery in my app :)

from ews-javascript-api.

gautamsi avatar gautamsi commented on June 2, 2024

I no longer have access to NTLM exchange server to test this :(

from ews-javascript-api.

joeauyeung avatar joeauyeung commented on June 2, 2024

Hi @gautamsi, I'm experiencing the same issue as @bfredo123.

I no longer have access to NTLM exchange server to test this :(

I've setup a test Exchange server following these instructions. Is there anything that the instructions are missing to enable NTLM?
https://learn.microsoft.com/en-us/exchange/plan-and-deploy/deploy-new-installations/create-azure-test-environments?view=exchserver-2019

from ews-javascript-api.

gautamsi avatar gautamsi commented on June 2, 2024

That should do it, let me know how can I access this. you can connect with me on linkedin (link in profile) to send message with credential.

from ews-javascript-api.

gautamsi avatar gautamsi commented on June 2, 2024

thanks @joeauyeung for the server access,

I have updated version to 0.14 (ccd9d30) which fixes this. The fix is sourced from SamDecrock/node-http-ntlm#107

alternative solution was to use NODE_OPTIONS=--openssl-legacy-provider or the option in the node command line.

from ews-javascript-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.