'"Error: TrustFailure (Authentication failed, see inner exception.)" when trying to access a php page from an xamarin app using RestSharp

I have a php page running on an Ubuntu server that accepts requests fine from my remote web site.

I am using CORS on the site as follows.

header("Access-Control-Allow-Origin: $http_origin");
header('Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE');
header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, Authorization, X-Request-With');

However when I call that url from within the xamarin app, via RestSharp (106.15.0), I am getting what I believe is a CORS related error. "Error: TrustFailure (Authentication failed, see inner exception.)" in response

        try
        {   
            var client = new RestClient(Urls.UploadUrl);
            var request = new RestRequest("resource",Method.POST);
                  request.AddFileBytes("photo", data, "photo.jpg");
                  IRestResponse response =await client.ExecuteAsync(request);

            if (!string.IsNullOrEmpty(response.Content))
            {
                return DeserializeObject<Rootobject>(response.Content);

How could I address this issue. Is there a CORS related piece of code I need to add in ?

Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source