这个问题是关于CakePHP发送错误的URL。完全理解为什么Facebook不喜欢这个URL,不清楚如何在CakePHP中修复它
尝试使用this HybridAuth plugin用于Cakephp,除了重定向URL有http,facebook不喜欢,一切似乎都有效。我需要把它变成https。我无法弄清楚如何操纵这个值。
https://www.facebook.com/v2.12/dialog/oauth?auth_type=rerequest...redirect_uri=http%3A%2F%2Fwww.example.com%2Fhybrid-auth%2Fendpoint%3Fhauth_done%3DFacebook&scope=email%2Cpublic_profile
这给了我这个错误,这是有道理的:
URL Blocked: This redirect failed because the redirect URI
is not whitelisted in the app’s Client OAuth Settings. Make
sure Client and Web OAuth Login are on and add all your app
domains as Valid OAuth Redirect URIs.
我一直试图解决这个问题大约两个小时。我试过设定
'hauth_return_to' => [
'controller' => 'Lookings',
'action' => 'find',
'prefix' => false,
'plugin' => false,
'_ssl' => true
]
在AppController中验证HybridAuth的设置,它似乎没有做任何事情。互联网上也尝试了很多随机的东西,似乎打破了更多的东西。我现在有点迷路了。
新的更新
我已经跟踪了这个URL的起源,直到loginBegin
中的hybridauth/Hybrid/Providers/Facebook.php
方法,并且它在$this->params['login_done'];
虽然我现在不确定这是设置的位置。
旧的更新
无论我做什么,更新Appcontroller身份验证设置似乎仍然不会影响此特定URL。我相信此设置与“URL Login done”重定向URL有关,我的问题是“URL Start login”URL,但我并不完全确定。
将'base_url'属性添加到HybridAuth
中的/config/hybridauth.php
对象以手动设置基本URL。
另外,看来base_url
是使用$ _SERVER ['HTTPS']创建的,在我当前的环境中显然没有设置为true。这可以在login
类的Hybrid_Provider_Adapter
方法中找到。
解决这些问题中的任何一个都应该解决问题。