facebook在画布应用程序中获取offline_access的session_key
嘿大家, 我正在尝试在画布应用程序中获取 facebook 会话(offline_access)的 session_key
和 secret
。
但是,我无法获得这两个特定变量。 当我在本地测试相同的代码时,我可以获取上面的变量(但这可能是因为本地应用程序不是画布应用程序)
我使用以下代码进行重定向:
$facebook->getLoginUrl(array(
'canvas' => 1,
'fbconnect' => 0,
'req_perms' => 'user_status,publish_stream,offline_access'
));
有人可以建议我如何做当用户授权应用程序时,获取 session_key
和 secret
? (用于永久离线访问)
这是通过 Facebook 转储的示例 session
:
Array (
[uid] => 100000926583671
[session_key] =>
[expires] => 0
[secret] =>
[base_domain] =>
[access_token] => 183043495039366|3ab6ac2asdkhj1bcfdec13d7-100000926583671|jJQaIT-n80YxioAasdwN0cm99U
[sig] => 2f64sadasc1da31c12927a052752776
)
这是错误:
Array (
[error] => Array (
[type] => OAuthException
[message] => An active access token must be used to query information about the current user.
)
)
Hey everyone,
I am trying to get the session_key
and secret
for a facebook session (offline_access) in canvas application.
However, I am unable to get these two particular variables.
When, I am testing the same code locally, I can get the variables above (but this can be because the local app is not a canvas application)
I 'm using the following code, for redirect:
$facebook->getLoginUrl(array(
'canvas' => 1,
'fbconnect' => 0,
'req_perms' => 'user_status,publish_stream,offline_access'
));
Can someone suggest me on how I can grab the session_key
and secret
, when the user authorizes the application? (for permanent offline access)
Here is an example session
dump via Facebook:
Array (
[uid] => 100000926583671
[session_key] =>
[expires] => 0
[secret] =>
[base_domain] =>
[access_token] => 183043495039366|3ab6ac2asdkhj1bcfdec13d7-100000926583671|jJQaIT-n80YxioAasdwN0cm99U
[sig] => 2f64sadasc1da31c12927a052752776
)
and this is the error:
Array (
[error] => Array (
[type] => OAuthException
[message] => An active access token must be used to query information about the current user.
)
)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
session_key 和 secret 现已弃用,Facebook 希望您使用 Oauth 身份验证架构。然后,您必须使用给定的 access_token (您在 $session 中正确获取的)来进行 api 调用。
尝试:
参考:
http://developers.facebook.com/docs/authentication/
session_key and secret are now deprecated, and Facebook wants you to use Oauth authentication schema. Then, you will have to use given access_token (that you correctly get in $session) to make your api calls.
Try:
Ref:
http://developers.facebook.com/docs/authentication/