dugongo21
dugongo21

Reputation: 11

Why I obtain MailKit.Net.Imap.ImapProtocolException: 'invalid digest response' during Authentication phase with MailKit?

I was trying to connect and authenticate a user with the ImapClient object of MailKit and during authentication the code throws the exception MailKit.Net.Imap.ImapProtocolException: 'invalid digest response'.

client.Connect(host, port, useSsl); client.Authenticate(username, password);

I expect the IsAuthenticated on true on the client object but the flow breaks givin that error. I also tried to change the version of the MailKit library and discovered that lower version works (eg: 2.0.1) instead of the current latest version (4.0.1).

Upvotes: 0

Views: 182

Answers (1)

dugongo21
dugongo21

Reputation: 11

After reading some documentation I discovered that of of the latest version of the IMAP protocol describes as deprecated the DIGEST-MD5 authorization mechanism of IMAP connection: https://datatracker.ietf.org/doc/draft-ietf-extra-imap4rev2/27/. So the solution is to remove forcefully the deprecated DIGEST-MD5 SASL mechanism from ImapClient.AuthenticationMechanisms property of MailKit: http://www.mimekit.net/docs/html/P_MailKit_Net_Imap_ImapClient_AuthenticationMechanisms.htm.

Upvotes: 1

Related Questions