- Home /
Help me reading a spreadsheet from Google drive using the API
I'm trying to access a published Google spreadsheet using the Google Drive API. However, I run into the following issues which are elaborated below (my code is at the bottom),
- I. Running my project I receive the following error: TlsException: Invalid certificate received from server. Error code: 0xffffffff800b010a. 
- Looking up the error leads me to having to call the mozroots.exe --import --sync 
1) Running my project I receive the following error in Unity:
TlsException: Invalid certificate received from server. Error code: 0xffffffff800b010a Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.validateCertificates (Mono.Security.X509.X509CertificateCollection certificates) Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.ProcessAsTls1 () Mono.Security.Protocol.Tls.Handshake.HandshakeMessage.Process () (wrapper remoting-invoke-with-check) Mono.Security.Protocol.Tls.Handshake.HandshakeMessage:Process () Mono.Security.Protocol.Tls.ClientRecordProtocol.ProcessHandshakeMessage (Mono.Security.Protocol.Tls.TlsStream handMsg) Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult) Rethrow as IOException: The authentication or decryption has failed. Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult) Rethrow as WebException: Error getting response stream (Write: The authentication or decryption has failed.): SendFailure System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) System.Net.HttpWebRequest.GetResponse () Google.GData.Client.GDataRequest.Execute () Rethrow as GDataRequestException: Execution of request failed: https://docs.google.com/spreadsheets/d/1CTyUyDj-yTWb1GjUhEsWE0kS_h41qbfN31yHrU8I75g/pubhtml?gid=1124040655&single=true Google.GData.Client.GDataRequest.Execute () Google.GData.Client.GDataGAuthRequest.Execute (Int32 retryCounter)
2) Looking up the error leads me to "solutions" saying I should call the mozroots.exe --import --sync (supplied with monodevelop).
However I either receive:
Downloading from 'http://mxr.mozilla.org/seamonkey/source/security/nss/lib/ckfw/ builtins/certdata.txt?raw=1'... Couldn't retrieve the file using the supplied information.
OR
Downloading from 'http://mxr.mozilla.org/seamonkey/source/security/nss/lib/ckfw/ builtins/certdata.txt?raw=1'... Importing certificates into user store... Error: System.NullReferenceException: Object reference not set to an instance of an object. at Mono.Security.X509.X509Certificate.get_Hash() at Mono.Security.X509.X509CertificateCollection.IndexOf(X509Certificate value ) at Mono.Security.X509.X509CertificateCollection.Contains(X509Certificate valu e) at Mono.Tools.MozRoots.Process() at Mono.Tools.MozRoots.Main(String[] args)
My code for the API is:
 SpreadsheetsService service = new SpreadsheetsService("exampleCo-exampleApp-1");
 
 SpreadsheetQuery query = new SpreadsheetQuery("https://docs.google.com/spreadsheets/d/1CTyUyDj-yTWb1GjUhEsWE0kS_h41qbfN31yHrU8I75g/pubhtml?gid=1124040655&single=true");
 SpreadsheetFeed feed = service.Query(query);
 
 //Console.WriteLine("Your spreadsheets:");
 foreach (SpreadsheetEntry entry in feed.Entries)
 {
     //Console.WriteLine(entry.Title.Text);
     Debug.Log(entry.ToString());
 }
And if I post at google it won't be a google related task.. So where does that leave me?
You seem to be downloading something from mozilla.org in both cases. How about them?
Answer by Simeon · May 08, 2016 at 11:42 PM
This is because of Mono doesn't trust anyone.. You can force it to connect by using this, every time you try to connect.
 public class UnsafeSecurityPolicy
 {
     public static bool Validator(object sender,X509Certificate certificate,X509Chain chain,SslPolicyErrors policyErrors)
     {
         //*** Just accept and move on...
         Debug.Log("Validation successful!");
         return true;
     }
 
     public static void Instate()
     {
         ServicePointManager.ServerCertificateValidationCallback = Validator;
     }
 }
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                