Ho provato il primo plugin che hai indicato ( OAuth Server ), mi pare funzionare. Ho seguito questa pagina (ho fatto fino lo step 3 ottenendo):
Codice:
{"access_token":"ohek****************hs6","expires_in":3600,"token_type":"Bearer","scope":"basic","refresh_token":"bv********************ne"}
Ma hai abilitato il plugin da "OAuth Server->Settings->OAuth Server Enabled"?
p.s: sei riuscito alla fine ad abilitare le connessioni server to server?
Comunque, ti lascio gli script con cui ho provato:
Codice HTML:
<html>
<head>
<title> Test login wp</title>
</head>
<body>
<form action="https://nick.altervista.org/oauth/authorize?response_type=code&client_id=3mmhH**********************ziVFz&redirect_uri=https://nick.altervista.org/wp-content/cb.php" method="post">
<input type="submit" value="Log In" \>
</form>
</body>
</html>
file cb.php (caricato tramite FTP nella cartella dove si trova l'ftp appena si apre (alterBlog: /wp-content/):
Codice PHP:
<?php
$client_id = '3mmhH******************ziVFz';
$client_secret = 'abg82*********************zA4pVD';
$server_url = 'https://nick.altervista.org';
$curl_post_data = array(
'grant_type' => 'authorization_code',
'code' => $_GET['code'],
'redirect_uri' => 'https://nick.altervista.org/wp-content/cb.php',
'client_id' => $client_id, // Only needed if server is running CGI
'client_secret' => $client_secret // Only need if server is running CGI
);
$curl = curl_init( $server_url . '/oauth/token/' );
// Uncomment if you want to use CLIENTID AND SECRET IN THE HEADER
//curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
//curl_setopt($curl, CURLOPT_USERPWD, $client_id.':'.$client_secret); // Your credentials goes here
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $curl, CURLOPT_POST, true );
curl_setopt( $curl, CURLOPT_POSTFIELDS, $curl_post_data );
curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER, false );
curl_setopt( $curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5' );
curl_setopt( $curl, CURLOPT_REFERER, 'http://www.example.com/1' );
$curl_response = curl_exec( $curl );
curl_close( $curl );
echo '<pre>';
print_r( $curl_response );
echo '</pre>';
Ciao!