[英]How can i do the user redirect automatically to oauth dialog when enter to canvas url?
Regards, 问候,
Back, when "Authenticated Referrals" not depreciated, if the user entered to my facebook application through the canvas url, was redirected to dialogue authorization (for permissions). 返回,当“ Authenticated Referrals”未贬值时,如果用户通过画布URL输入到我的Facebook应用程序,则将其重定向到对话授权(用于权限)。
Now that do not exist the option, I must do it manually so you can redirect url through the canvas. 现在该选项不存在,我必须手动进行操作,以便您可以通过画布重定向url。
I am using Codeigniter for it and from what I see, facebook cancel any redirection I do. 我正在使用Codeigniter,从我看到的情况来看,facebook取消了我所做的任何重定向。
Here is my code: 这是我的代码:
try {
$fb_id = $this->facebook->getUser();
if ($fb_id) {
$fb_data = $this->facebook->api('/me');
return $fb_data;
} else {
echo 'You don't give me the permissions';
$url = $url = $this->facebook->getLoginUrl(array(
'scope' => 'email,user_likes,user_about_me,publish_stream,user_birthday',
'redirect_uri' => $this->config->item('app_name')
));
header("location:$url");
redirect($url, 'refresh');
}
} catch (Exception $exc) {
echo $exc;
}
Is there a simpler way to do it? 有更简单的方法吗? Any examples you can show me?
有什么例子可以告诉我吗? Thanks in advance
提前致谢
NOTE: My application is a (for now) recorder audio for users First is a registration with personal information. 注意:我的应用程序是(暂时)针对用户的记录器音频。首先是个人信息的注册。 Then show the recorder audio.
然后显示录音机音频。
My target is when a new user find my application (apps.facebook.com/my_app), enter to my app and show automatically the oauth dialog for permission (as before). 我的目标是,当新用户找到我的应用程序(apps.facebook.com/my_app)时,进入我的应用程序并自动显示oauth对话框以获取许可(与以前一样)。 Then enter to the registration view.
然后进入注册视图。
This has nothing to do with codeigniter, just make sure that your redirect_uri
is your canvas page URL " apps.facebook.com/app_name
". 这与codeigniter无关,只要确保您的
redirect_uri
是画布页面URL“ apps.facebook.com/app_name
”即可。
And then use Javascript to redirect the user to the OAuth dialog with something like: 然后使用Javascript将用户重定向到OAuth对话框,如下所示:
echo("<script> top.location.href='" . $url . "'</script>");
also check out the Canvas Tutorial . 还可以查看“ 画布教程” 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.