Auth with a preAuth Key

Have a great idea for extending Zimbra? Share ideas, ask questions, contribute, and get feedback.
Post Reply
Tictac21
Posts: 1
Joined: Fri Jan 19, 2018 9:49 am

Auth with a preAuth Key

Post by Tictac21 »

Hy,

I try to connect with an app in C#.Net to an Zimbra account for parse the mailBox.
I can connect with the account and the password but with an preauth key it dosn't work (auth.failed).

I try to connect with this xml:

Code: Select all

 ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, errors) => true;
            StringBuilder sbXML2 = new StringBuilder();
            sbXML2.Append("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
            sbXML2.Append("<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\">");
            sbXML2.Append("<soap:Header>");
            sbXML2.Append("<context xmlns=\"urn:zimbra\">");
            sbXML2.Append("<format type=\"xml\"/>");
            sbXML2.Append("</context>");
            sbXML2.Append("</soap:Header>");
            sbXML2.Append("<soap:Body>");
            
            sbXML2.Append("<AuthRequest xmlns=\"urn:zimbraAccount\">");
            	sbXML2.Append(string.Format("<account>{0}</account>", userId));
	        sbXML2.Append(string.Format("<preauth timestamp =\"{0}\" expires=\"60000\">{1}</preauth>", timestamp,pwd));            
            	//sbXML2.Append(string.Format("<password>{0}</password>", pwd));
	        sbXML2.Append("</AuthRequest>");

            sbXML2.Append("</soap:Body>");
            sbXML2.Append("</soap:Envelope>");
            
               HttpWebRequest httpZimbraRequest2 = (HttpWebRequest)WebRequest.Create("https://"+zimbra_serveur + "/service/soap");
            
I always get " Authentification failed for "account".
Thanks you for your help.
Best regards
Post Reply