我检查了各种答案-无法使其正常工作,并且它们并没有提供太多新内容-只是说要在该字段中添加url。
其中一位说“请确保您的应用ID和秘密密钥正确无误。”我发现它们没有设置,但是现在管理员说他补充了这些,所以应该没问题。
还有什么?如何调试?
“ URL阻止:此重定向失败,因为在应用程序的客户端OAuth设置中未将重定向URI列入白名单。请确保已打开客户端和Web OAuth登录,并将您的所有应用程序域都添加为有效的OAuth重定向URI。”
它还告诉您检查Client和Web OAuth进行操作,但是由于我已阅读或观看了Facebook文档中的某个内容,因此我关闭了它们以提高安全性。并且由于登录在本地有效且已关闭,因此不需要它们。我通过尝试打开它们进行了测试,但是正如我所期望的那样,它们无法解决问题。
更新:重定向uri参数为redirect_uri = https%3A%2F%2Falpha.vop.veracityinsurance.com%2Fconnect%2Ffacebook%2Fcheck
制作视频:https://www.loom.com/share/88e607aece6b45489214d95ee01bbb0b
我具有调试功能,并将其推送到打印提供程序的服务器:
$provider = (array)$this->clientRegistry->getClient('facebook_main')->getOAuth2Provider();
print_r($provider);
并且从该类中,我看到服务器中的应用程序ID是正确的。
config.yml
knpu_oauth2_client:
clients:
# the key "facebook_main" can be anything, it
# will create a service: "knpu.oauth2.client.facebook_main"
facebook_main:
# this will be one of the supported types
type: facebook
client_id: '%env(CONFIG__OAUTH__FACEBOOK__ID)%'
client_secret: '%env(CONFIG__OAUTH__FACEBOOK__SECRET)%'
# the route that you're redirected to after
redirect_route: connect_facebook_check
redirect_params: {}
graph_api_version: v5.0
顺便说一句,我正在使用symfony捆绑软件进行集成https://github.com/knpuniversity/oauth2-client-bundle