Im' pretty new to ORCID and to API request, so I'm sorry if the answer to my problem is obvious. I'm trying to implement the ORCID athentication system on my website but when I'm supposed to received some informations about the user who anthenticate I got the 301 error.
I have put the login button on a first page :
<button id="connect-orcid-button" onclick="openORCID()"><img id="orcid-id-icon" src="https://orcid.org/sites/default/files/images/orcid_24x24.png" width="24" height="24" alt="ORCID iD icon"/>Se connecter ou s'enregistrer avec un ORCID iD</button>
function openORCID() {
var oauthWindow = window.open("http://orcid.org/oauth/authorize?client_id=[MyClientId]&response_type=code&scope=/authenticate&redirect_uri=http://localhost/MASA_openGuide/openGuide/portal.php", "_blank", "toolbar=yes, scrollbars=yes, width=500, height=600, top=500, left=500");
}
When clicking, it's working well and I can authenticate without a problem and it send me to the second page, I set this code on it to get the information thanks to the token :
$code = $_GET["code"];
echo $code;
$lien = 'http://orcid.org/oauth/token';
$header = array(
'Accept' => 'application/json',
);
$postField = array(
'url' => 'http://orcid.org/oauth/token',
'client_id' => [myClientId],
'client_secret' => [myClientSecret],
'grant_type' => 'client_credentials',
'scope' => '/read-public'
);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $lien);
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postField);
$result = curl_exec($curl);
curl_close($curl);
And then I get the error "301 Moved Permanently", on the ORCID website it says that "This ORCID iD has been deprecated into another, see the location returned for the updated ORCID iD if you are not automatically forwarded". But I'm not sure what I should do :/ The objective is just to get the record to post some of this information on the website and store them in a cookie.
I hope that I succed to be clear.
Thanks a lot for your help and again sorry if the anwser is obvious ...