RESTful API get request not working in most cases

I’ve been trying to use RESTful API to send a get request to my blynk server and fetch a certain pin value. However, the get request only works when it’s being sent from either a local file, or from http://blynk-cloud.com/auth_token/get/pin itself. When I try to send it from the console of any other website, I always get this error:

"Mixed Content: The page at ‘https://’ was loaded over HTTPS, but requested an insecure resource ‘https://188.166.206.43/auth_token/get/pin’. This request has been blocked; the content must be served over HTTPS."

I tried changing the link to “https://188.166.206.43/auth_token/get/pin” but then I get this error:
"GET https://188.166.206.43/auth_token/get/pin net::ERR_CERT_AUTHORITY_INVALID"

I’ve tried sending the get requests to both https://188.166.206.43/auth_token/get/pin and http://blynk-cloud.com/auth_token/get/pin, and the error persists in both cases.

I’ve been using the code right off the Blynk API docs:

var request = new XMLHttpRequest();

request.open('GET', 'http://blynk-cloud.com/auth_token/get/pin');

request.onreadystatechange = function () {
  if (this.readyState === 4) {
    console.log('Status:', this.status);
    console.log('Headers:', this.getAllResponseHeaders());
    console.log('Body:', this.responseText);
  }
};

request.send();

I realise that this is probably some sort of a security issue, but I don’t know how to fix it. Please help.

Are you actually using the word “pin” in this request, or are you using something like “D5” or “V20” ?

Pete.

I’ve been using V1 and V50.