I am working on Monodroid. I have added a Dropnet DLL (I have compiled it in Monodevelop).
I am trying to retrieve account info, below is my code
DropNetClient _client;
string dropbox_appkey = "XXX";
string dropbox_appsecret = "XXXX";
_client = new DropNetClient(dropbox_appkey, dropbox_appsecret);
_client.UserLogin = new DropNet.Models.UserLogin { Token = "XXX", Secret = "XXXX" };
var accountInfo = _client.AccountInfo();
I am getting error when the below code gets executed
return (HttpWebResponse)request.GetResponse();
error received is:
System.Net.WebException: Error getting response stream (Write: The authentication or decryption has failed.): SendFailure ---> System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: Invalid certificate received from server. Error code: 0xffffffff800b010a at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.validateCertificates (Mono.Security.X509.X509CertificateCollection certificates) [0x00000] in :0 at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.ProcessAsTls1 () [0x00000] in :0 at Mono.Security.Protocol.Tls.Handshake.HandshakeMessage.Process () [0x00000] in :0 at Mono.Security.Protocol.Tls.ClientRecordProtocol.ProcessHandshakeMessage (Mono.Security.Protocol.Tls.TlsStream handMsg) [0x00000] in :0 at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult) [0x00000] in :0 --- End of inner exception stack trace --- at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult) [0x00000] in :0 --- End of inner exception stack trace --- at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in :0 at System.Net.HttpWebRequest.GetResponse () [0x00000] in :0 at RestSharp.Http.GetRawResponse (System.Net.HttpWebRequest request) [0x00002] in e:\sujit\development\try5\restsharp-RestSharp-eef0c86\RestSharp\Http.Sync.cs:170
When I run URL in browser which is something like this:
I get proper response like this:
{"referral_link": "https://www.dropbox.com/referrals/XXXX", "display_name": "XXX XXX", "uid": XXXX, "country": "IN", "quota_info": {"shared": XXX, "quota": XXXX, "normal": XXXX}, "email": "[email protected]"}
My question is why am I getting strange error using Monodroid Emulator ( I am using Monodevelop version 3.0.4.6 and I am testing on API_10 EMulator.
What should I do?
Note:
Just to add, using Authentication token of dropbox obtained by authenticating it in desktop application. I think we can reuse token of a user which uses our Desktop application for a Mobile application. Right?