简体   繁体   English

输入画布URL时,用户如何自动将其重定向到oauth对话框?

[英]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.

相关问题 输入画布网址时,facebook自动重定向到oauth对话框而不是索引页 - When entering canvas url, facebook automatically redirect to oauth dialog not index page 创建Facebook服务时,我要输入什么“重定向网址”? - What do i enter as for the “redirect Url” when creating a Facebook service? 如何通过打开新窗口执行OAuth请求,而不是从当前页面重定向用户? - How can I do OAuth request by open new window, instead of redirect user from current page? 使用Facebook Oauth时,如何在URL上使用#_ = _停止瞬时重定向? - How can I stop the momentary redirect with the #_=_ on the url when using Facebook Oauth? 如何在JavaScript中自定义Facebook OAuth对话框? - How can I customize facebook oauth dialog in javascript? 如何在画布应用程序上为共享对话框设置新消息? - How can I set a new message for a share dialog on a canvas app? 不直接使用OAuth对话框时,如何从服务器facebook api调整facebook登录名的显示? - How can I adjust the display of a facebook login from my server facebook api when it is not using the OAuth Dialog directly? 通过add.php(Facebook)添加页面后,如何将用户重定向到自定义网址 - how can i redirect a user to custom url after adding page through add.php (Facebook) 如何为OAuth Facebook登录名指定重定向URL - How to specify redirect URL for OAuth Facebook Login Facebook Canvas应用程序-OAuth重定向提供2个弹出窗口,而不是“增强的身份验证”对话框 - Facebook Canvas app - OAuth redirect gives 2 popups instead of Enhanced Auth Dialog
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM