Skip to content

Commit 2d4e340

Browse files
committed
Windows and Android ServerCertificateValidation. Resolves #5
1 parent c0826f7 commit 2d4e340

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

Assets/MobileServices/client/MobileServiceClient.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using RestSharp;
44
using System.Collections.Generic;
55
using System;
6-
#if !NETFX_CORE
6+
#if !NETFX_CORE || UNITY_ANDROID
77
using System.Net;
88
using System.Security.Cryptography.X509Certificates;
99
using System.Net.Security;
@@ -28,10 +28,9 @@ public MobileServiceClient(string appUrl, string appKey) : base(appUrl)
2828
AppUrl = appUrl;
2929
AppKey = appKey;
3030

31-
// required for running in Windows
31+
// required for running in Windows and Android
3232
#if !NETFX_CORE || UNITY_ANDROID
33-
Debug.Log("ServerCertificateValidation");
34-
//ServicePointManager.ServerCertificateValidationCallback = (p1, p2, p3, p4) => true; // NB: this is a workaround for "Unable to find /System/Library/Frameworks/Security.framework/Security" issue in Android
33+
Debug.Log("ServerCertificateValidation");
3534
ServicePointManager.ServerCertificateValidationCallback = RemoteCertificateValidationCallback;
3635
#endif
3736
}
@@ -79,7 +78,7 @@ public void Login(MobileServiceAuthenticationProvider provider)
7978
this.ExecuteAsync(request, callback);
8079
}
8180

82-
#if !NETFX_CORE
81+
#if !NETFX_CORE || UNITY_ANDROID
8382
private bool RemoteCertificateValidationCallback(System.Object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
8483
{
8584
// Check the certificate to see if it was issued from Azure

Assets/Scenes/HighscoresDemo.unity

-4 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)