FBML Canvas 应用程序身份验证
我正在修改 FBML 画布应用程序以使用新的 PHP SDK 和身份验证,而不是旧的 REST api。
现在我正在尝试使用此代码片段:
$me = null;
// Session based API call.
if ($session) {
try {
$uid = $facebook->getUser();
$me = $facebook->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
}
}
// login or logout url will be needed depending on current user state.
if ($me) {
} else {
$loginUrl = $facebook->getLoginUrl(array('req_perms' => 'user_birthday, publish_stream, email'));
header('Location: '.$loginUrl);
}
但是,如果我对任何不相关的 URL 使用 php 标头函数,则会收到此错误:
Application Temporarily Unavailable
The URL [https://www.facebook.com/login.php?.........] is not valid.
Sorry, the application you were using is experiencing a problem. Please try again later.
如果我需要使用最新的 PHP SDK 在我的 FBML 画布应用程序上进行身份验证,如何正确重定向到请求扩展权限的应用程序登录页面?
I'm modifying an FBML canvas app to use the new PHP SDK and authentication instead of the old REST api.
Right now I'm attempting to use this snippet:
$me = null;
// Session based API call.
if ($session) {
try {
$uid = $facebook->getUser();
$me = $facebook->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
}
}
// login or logout url will be needed depending on current user state.
if ($me) {
} else {
$loginUrl = $facebook->getLoginUrl(array('req_perms' => 'user_birthday, publish_stream, email'));
header('Location: '.$loginUrl);
}
However if I use the php header function for any URL that isn't relative, I get this error:
Application Temporarily Unavailable
The URL [https://www.facebook.com/login.php?.........] is not valid.
Sorry, the application you were using is experiencing a problem. Please try again later.
If I need to have authentication on my FBML canvas app using the latest PHP SDK, how do I properly redirect to the app login page that requests the extended permissions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来您无法使用服务器端重定向(header())将用户推送到身份验证页面。我现在正在使用这个:
Looks like you cannot use a server side redirect (header()) to push user to the auth page. I'm using this at the moment: