2013-04-04 31 views
4

我的Facebook应用昨天工作正常,但今天它无法获取access_token。该请求无效,因为应用密钥与客户端令牌相同

我的代码是:

$token_url="https://graph.facebook.com/oauth/access_token?"."client_id=".$app_id."&redirect_uri=".urlencode($my_url)."&client_secret=".$app_secret."&code=".$code; 
$response=file_get_contents($token_url); 
print_r($response); 
$params = null; 
parse_str($response, $params); 
echo $params['access_token']; 

的错误是:

{ 
    "error": { 
     "message": "The request is invalid because the app secret is the same as the client token", 
     "type": "OAuthException", 
     "code": 1 
    } 
} 

如何解决这个问题?

我也用卷曲,但反应是:

object(stdClass)#121 (1) { 
    ["error"]=> object(stdClass)#11 (3) { 
     ["message"]=> string(77) "The request is invalid because the app secret is the same as the client token" 
     ["type"]=> string(14) "OAuthException" 
     ["code"]=> int(1) 
    } 
} 
+0

你如何实例化Facebook的对象?请在此处添加代码块。鉴于错误消息,它看起来像你传递给构造函数的值是无效的或不正确的。 – 2013-04-04 13:03:44

+0

如果我使用新的app_id和app_secret然后正常工作....... – Rajan 2013-04-04 13:09:42

+0

你可以发布这个问题的答案吗?如果你使用了新的app_id和app_secret,你的意思是什么?你是否在fb dev页面申请了新的? – isyi 2013-04-04 19:58:09

回答

7

确保客户令牌是从应用程序的秘密(高级>安全)不同,并且确保你的应用程序是一个Web应用程序,而不是本机。

0

我重置app_secret再正常工作,改变高级 - >安全WEB

0

我有同样的问题,几天,我搜索和搜索解决方案。但所有的作品,当我设置“本机或桌面应用程序”为“否” - 在“应用程序 - >设置 - >高级”

相关问题