2017-01-19 4 views
0

WordPress 4.7.1에서 작동되도록하기 위해 Guide: Integrate Log In with PayPal을 따르고 있습니다. Log In In PayPal 버튼을 성공적으로 임베드했습니다. 그것을 클릭하면 "returnurl"로 리디렉션되는 로그인이 나타납니다.invalid_grant PayPal에서 OpenID Connect 토큰을 얻으려고 시도합니다.

나는 현재 토큰 서비스 엔드 포인트에 이전 단계에서받은 인증 코드를 전달하여 액세스 토큰을 수신하려고 시도하고 있습니다.

<?php 

$curl = curl_init('https://api.sandbox.paypal.com/v1/identity/openidconnect/tokenservice'); 
// not $curl = curl_init('https://api.sandbox.paypal.com/v1/oauth2/token'); 
curl_setopt($curl, CURLOPT_POST, true); 
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); 
$code = $_GET['code']; // The code from the previous request 
$redirect_uri = 'http://xxxxxx.contemplate.me.ke/'; 

curl_setopt($curl, CURLOPT_POSTFIELDS, array(
    'redirect_uri' => $redirect_uri, 
    'grant_type' => 'authorization_code', 
    'code' => $code 
)); 

curl_setopt($curl, CURLOPT_USERPWD, 
    "My-Client-Id" . ":" . 
    "My-Secret"); 

$auth = curl_exec($curl); 
print '$auth = ';print_r($auth); // to see the error 
$secret = json_decode($auth); 
$access_key = $secret->access_token; 
?> 

나는이에서 얻을 모두에 로그인 한 후 :

$auth = {"error_description":"Grant type is null","error":"invalid_grant","correlation_id":"0f5787fc6413f","information_link":"https://developer.paypal.com/docs/api/#errors"} 

내가 잘못 뭐하는 거지

내 "returnurl는"(Guide: grant token from authorization code에 의해 제안)이 컬 코드가?

답변

관련 문제