mhewedy / ews

Go package wrapper for Exchange Web Service (EWS). Supports NTLM and more! Used in mego https://github.com/mhewedy/mego
Other
42 stars 27 forks source link

401 Unauthorized #4

Closed yalva closed 4 years ago

yalva commented 4 years ago

I'm trying to send an email with the example in readme, and its throwing 401 Unauthorized error, I've tested the same URL and credentials with nodejs ews and it works. any idea?

knochms commented 4 years ago

Me too... I think there is a problem with the ntlmssp.Negotiator{} (from: https://github.com/Azure/go-ntlmssp).

` Response: HTTP/1.1 401 Unauthorized Content-Length: 0 Date: Fri, 19 Jun 2020 10:15:23 GMT+3 Request-Id: 7*****9 Server: Microsoft-IIS/8.5 Set-Cookie: ClientId=IZ*OP; expires=Sat, 19-Jun-2021 10:15:24 GMT+3; path=/; HttpOnly Www-Authenticate: Negotiate Www-Authenticate: NTLM X-Feserver: *** X-Powered-By: ASP.NET


401 Unauthorized `

Any ideas?

mhewedy commented 4 years ago

Sorry for late reply.

if you are using an on-premises Exchange server (or even if you manage your servers at the cloud), you need to pass the username as AD_DOMAINNAME\\username instead, for examle MYCOMANY\\mhewedy.

mhewedy commented 4 years ago

I will close this as resolved. feel free to reopen if you face the suggested solution didn't fix your issue.