简体   繁体   English

Facebook getLoginUrl for canvas

[英]Facebook getLoginUrl for canvas

I have a canvas app in facebook, and I'm using the code: 我在facebook上有一个画布应用程序,我正在使用代码:

$loginUrl = $facebook->getLoginUrl(
    array(
    'canvas'    => 1,
    'fbconnect' => 0,
    'scope' => 'email,publish_stream,offline_access'

));

However all the time when a user clicks the "Go To App" button it redirects straight back to my app not in facebook, but in fact the full URL. 但是,当用户单击“转到应用程序”按钮时,它会直接重定向到我的应用程序,而不是在Facebook,但实际上是完整的URL。

How can I make it go back to the app page? 如何让它返回应用页面?

Ok, so the answer was fairly simple. 好的,答案很简单。

$loginUrl = $facebook->getLoginUrl(
    array(
    'canvas'    => 1,
    'fbconnect' => 0,
    'scope' => 'email,publish_stream,offline_access',
    'redirect_uri' => 'http://uri'

));

However if you have Canvas App selected in app settings that redirect_uri must be the same as the url set for Canvas App. 但是,如果您在应用程序设置中选择了Canvas App,则redirect_uri必须与为Canvas App设置的URL相同。

If it is just a page tab, you can redirect to anything 如果它只是一个页面选项卡,您可以重定向到任何内容

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM