首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Aweber授权码不起作用

Aweber授权码不起作用
EN

Stack Overflow用户
提问于 2012-09-07 00:53:31
回答 1查看 1.9K关注 0票数 1

这里有一个奇怪的问题:当我授权我的Aweber应用程序时,授权码第一次就起作用了。

但是,当我刷新页面时,我得到一个错误: AWeberAPIException:

代码语言:javascript
复制
Type: UnauthorizedError 
Msg : RequestToken key is invalid.     https://labs.aweber.com/docs/troubleshooting#unauthorized 

文档:https://labs.aweber.com/docs/troubleshooting#unauthorized

请帮帮忙这真的很让人沮丧。下面是我使用的代码:

代码语言:javascript
复制
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>";
}
EN

回答 1

Stack Overflow用户

发布于 2012-09-08 03:58:31

好了,我解决了!

授权令牌包含$consumerKey$consumetSecret$accessKey$accessSecret

下面的行将返回一个Array

代码语言:javascript
复制
$auth = AWeberAPI::getDataFromAweberID($authorization_code);

所以,

代码语言:javascript
复制
$consumerKey = $auth[0];
$consumerSecret = $auth[1];
$accessKey = $auth[2];
$accessSecret = $auth[3];

然后,您只需使用这些值来授权应用程序!当然,如果它被多个用户使用,您需要为每个用户存储这些值。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12304829

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档