First step, asking for an URL to send the user to.
HELPTEXT;
echo"Calling: $req_req".PHP_EOL;
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,(string)$req_req);
if($baseUrlIsSsl===true){
curl_setopt($ch,CURLOPT_PORT,443);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,0);
}
curl_setopt($ch,CURLOPT_HEADER,0);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
if($moreVerbose===true){
curl_setopt($ch,CURLOPT_VERBOSE,1);
}
$data=curl_exec($ch);
if(!$data){
die('cURL error: '.curl_error($ch));
}
$token=json_decode($data);
// phpcs:disable Generic.Files.LineLength
print<<<HELPTEXT
Response body should be a JSON object with three keys:
- key
- secret
- oauth_callback_confirmed
You got: {$data}
************************
Step two!
So far, we made one request and we should have what we need to get acknowledgement from the end user.
In order to continue, we have to ask the user for a permission. With what we just did, it gave us a one-time URL to send our user to.
The process can continue only if the user accepted it. Once accepted, MediaWiki's OAuth Extension creates an "oauth_verifier" string that you need to give for the next step.
Now, WITH YOUR WEB BROWSER, follow this link and pass through the validation.