Hi team, so im creating this app using Foursquare's Places API, everything seems good, but im not able to get the values from the API to the JSon variable, since when debbugin the app shows the attached error on the line before the Json (Line 23)
"The SSL connection could not be established, see inner exception"
Inner Exception says the following:
"Ssl error:1000007d:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED
at /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/boringssl/ssl/handshake_client.c:1132"
I've tried using the next line of code on top of the method
ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;
I've also tried:
client.RemoteCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
But this last one is not recognizng the RemoteCertificateValidationCallback method, can some one please help ? Here's the code im using for the client
ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;
List<Result> venues = new List<Result>();
var url = VenueRoot.GenerateUrl(Latitude, Longitude);
RestClient client = new RestClient(url);
var request = new RestRequest(Method.Get.ToString());
request.AddHeader("Accept", "application/json");
request.AddHeader("Authorization", Constants.HEADER);
RestResponse response = await client.ExecuteAsync(request);
var json = response.Content.ToString();
Hi, NeidennX-8393. Please make sure the server's certificate is valid. And try using HttpClient, and use AndroidClientHandler
class to create the client.
Here is a similar issue thread, you could refer to it: https://github.com/xamarin/xamarin-android/issues/4688#issuecomment-658833938
Hi @JarvanZhang
Certificacte is valid, was updated Nov 2021, i changed the structure as suggested, but the issue persist the difference is that now th exception is not popping on the Response variable, im not quite sure how to solve this SSL conflict.
This is the current method
public static async Task<List<Result>> GetVenues(double Latitude, double Longitude)
ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;
List<Result> venues = new List<Result>();
var url = VenueRoot.GenerateUrl(Latitude, Longitude);
using (HttpClient Client = new HttpClient())
var Response = await Client.GetAsync(url);
Client.DefaultRequestHeaders.Add("Accept", "application/json");
Client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Authorization", Constants.HEADER);
var Json = await Response.Content.ReadAsStringAsync();
var venueRoot = JsonConvert.DeserializeObject<Venue>(Json);
venues = venueRoot.Results as List<Result>;
catch (Exception e)
var CatchException = e.ToString();
return venues;
@JarvanZhang Not quite sure how to implement that in my especific case to be honest, but for some reason the SSL Exception is not being thrown anymore, still, the Json Variable is not getting loaded, im having the following exception on the await Response.Content.ReadAsStringAsync();
{StatusCode: 401, ReasonPhrase: 'Unauthorized', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
Accept-Ranges: bytes
Access-Control-Allow-Credentials: true
Access-Control-Allow-Credentials: true
Access-Control-Allow-Credentials: true
Access-Control-Allow-Credentials: true
Access-Control-Allow-Credentials: true
Access-Control-Allow-Credentials: true
Access-Control-Allow-Credentials: true
Access-Control-Allow-Credentials: true
Access-Control-Allow-Credentials: true
Access-Control-Allow-Credentials: true
Access-Control-Allow-Credentials: true
Access-Control-Allow-Credentials: true
Access-Control-Allow-Credentials: true
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: https://developer.foursquare.com
Access-Control-Allow-Origin: https://developer.foursquare.com
Access-Control-Allow-Origin: https://developer.foursquare.com
Access-Control-Allow-Origin: https://developer.foursquare.com
While the Json var is loading the following message:
{"message":"Invalid request token."}