2012-09-06 6 views
1

이상한 문제가 있습니다. Aweber 앱을 인증 할 때 인증 코드가 처음으로 작동합니다. 내가 페이지를 새로 고침 할 때Aweber 인증 코드가 작동하지 않음

그러나 오류가 발생합니다 : AWeberAPIException :

Type: UnauthorizedError 
Msg : RequestToken key is invalid.  https://labs.aweber.com/docs/troubleshooting#unauthorized 

문서 :

https://labs.aweber.com/docs/troubleshooting#unauthorized이 정말 실망 도와주세요. 사용중인 코드는 다음과 같습니다.

require_once('aweber_api/aweber_api.php'); 

try { 
# set $authorization_code to the code that is given to you from 
# https://auth.aweber.com/1.0/oauth/authorize_app/YOUR_APP_ID 
    $authorization_code="Azh..."; 

$auth = AWeberAPI::getDataFromAweberID($authorization_code); 
list($consumerKey, $consumerSecret, $accessKey, $accessSecret) = $auth; 

# Store the Consumer key/secret, as well as the AccessToken key/secret 
# in your app, these are the credentials you need to access the API. 
//$account = $aweber->getAccount($accessKey, $accessSecret); 

} 
catch(AWeberAPIException $exc) { 
print "<h3>AWeberAPIException:</h3>"; 
print " <li> Type: $exc->type    <br>"; 
print " <li> Msg : $exc->message   <br>"; 
print " <li> Docs: $exc->documentation_url <br>"; 
print "<hr>"; 
} 

답변

4

OK, 해결했습니다.

권한 부여 토큰은, $consumerKey$consumetSecret, $accessKey$accessSecret

가 다음 줄 그래서 Array

$auth = AWeberAPI::getDataFromAweberID($authorization_code); 

반환

$consumerKey = $auth[0]; 
$consumerSecret = $auth[1]; 
$accessKey = $auth[2]; 
$accessSecret = $auth[3]; 

이 들어 그리고 당신은 단지에 그 값을 사용 신청서를 승인하십시오! 물론 여러 사용자가 사용하는 경우 각 사용자에 대해이 값을 저장해야합니다.

+3

답안에 누락되었습니다 : 평생에 한번'AWeberAPI :: getDataFromAweberID()'를 호출하십시오. 즉, 다른 자격 증명을 데이터베이스에 저장해야합니다. 그렇습니다. 선택. –

관련 문제