php Facebook OAuth redirect_uri 问题“应用程序配置不允许给定的 URL。”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3707738/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 10:47:45  来源:igfitidea点击:

Facebook OAuth redirect_uri problem 'Given URL is not permitted by the application configuration.'

phpfacebookoauthoauth-2.0

提问by rob_mccann

When asking for authorisation by redirecting to the following url:

通过重定向到以下 URL 请求授权时:

https://graph.facebook.com/oauth/authorize?client_id=...&scope=email,offline_access&redirect_uri=http%3A%2F%2Flocalhost%2Flogin%2Findex.php%3Fcallback%3Dfacebook

Facebook returns 'Invalid redirect_uri Given URL is not permitted by the application configuration.'

Facebook 返回“无效的 redirect_uri 应用程序配置不允许给定的 URL。”

Possibly because my application is registered with http://syncacity.comon the application configuration. But still, twitter allows me to redirect to any url, so why is facebook whining?

可能是因为我的应用程序注册了 http://syncacity.com上的应用程序配置。但是,twitter 允许我重定向到任何 url,那么为什么 facebook 抱怨呢?

I'd appreciate your thoughts :)

我很感激你的想法:)

采纳答案by rob_mccann

why not just edit your hosts file and point your domain to your local ip then you only need to switch the dev box hosts before doing anything.

为什么不编辑您的主机文件并将您的域指向您的本地 IP,那么您只需要在执行任何操作之前切换开发箱主机。

回答by Blake

Change your application url to http://localhostwhile you develop and then to your site once it's in production. :)

在开发时将您的应用程序 url 更改为http://localhost,然后在生产中更改为您的站点。:)

回答by Bernard Banta

it got resolved - thanks to one of the Facebook platform developers.

它得到了解决 - 感谢 Facebook 平台开发人员之一。

Let's say your local site URL is http://localhost:8000You will need to add http://localhost:8000to the Facebook App setting at "Settings -> Basic -> Website->Site URL."

假设您的本地站点 URL 是http://localhost:8000您需要将http://localhost:8000 添加到“设置 -> 基本 -> 网站 -> 站点 URL”的 Facebook 应用设置。

回答by lubosdz

Following worked for me:

以下为我工作:

App Domains: localhost
Site URL: http://localhost

enter image description here

在此处输入图片说明

回答by Anthony Johnston

I create a test app in sandbox mode (advanced settings) then integrate to that for development and test

我在沙盒模式(高级设置)中创建了一个测试应用程序,然后集成到该应用程序中进行开发和测试

回答by Pekka

You have defined localhost url in redirect_url (redirect_uri=http://localhost/login/index.php..) I'm not familiar with OAuth but that might be the problem.

您已经在 redirect_url (redirect_uri= http://localhost/login/index.php..) 中定义了 localhost url我不熟悉 OAuth 但这可能是问题所在。