問題描述
我正在使用 Codeigniter 3、Facebook SDK 和這個 這個庫開發一個 Web 應用程序 用于管理請求.
I'm developing a WebApp with Codeigniter 3, Facebook SDK and this this library for manage the request.
使用 Facebook 登錄的主要教程一切正常.一個例子:
Using the main tutorial for Facebook Login all things work fine. An example here:
<?php $login = $this->facebook->login_url(); ?>
<a href="<?=$login;?>"> Login with your Facebook account </a>
之后我可以使用訪問令牌執行任何請求.
After that I can do any request with the access token.
在新的更新中,Facebook 應用程序必須激活重定向 URI 的嚴格模式.所以在開發者門戶中,我像這樣激活了我的網址:
With the new update, facebook apps must activate the Strict Mode for Redirect URIs. So in the developer portal I've activated my urls like this:
http://localhost/home/login
但是當我嘗試登錄時,facebook 響應為
But when I try to log in, facebook response with
http://localhost/home/login?code=SOME_STRING_HERE&state=SOME_STRING_HERE#_=_
沒有任何訪問令牌或有效會話.
without any access token or valid session.
我是否跳過了任何步驟?
Am I skipping any steps?
使用相同的代碼,禁用重定向 URI 的嚴格模式一切正常.
With the same code, disabling Strict Mode for Redirect URIs all things work fine.
謝謝
推薦答案
在我為重定向 URI 模式啟用嚴格模式后,當我嘗試使用 Facebook 登錄時,我開始收到圖形返回錯誤:無法加載 URL:盡管我指定了重定向 url,但此 URL 的域未包含在應用程序的域中"錯誤??.從圖形 sdk v4 升級到圖形 sdk v5 后,錯誤消失了.
After I enabled Strict Mode for Redirect URIs mode, when I try to login using facebook I started getting "Graph returned an error: Can't Load URL: The domain of this URL isn't included in the app's domains" error eventhough I specified redirect urls. After upgrading from graph sdk v4 to graph sdk v5 error is gone.
這篇關于使用重定向 URI 的嚴格模式登錄 Facebook的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!