简体   繁体   English

无效的redirect_uri与'omniauth-facebook'gem

[英]Invalid redirect_uri with 'omniauth-facebook' gem

So I went to this guide that explains how to start with omniauth. 因此,我去了本指南 ,该指南解释了如何从omniauth开始。 When I got to the end of step 4 to test the application at localhost:3000/auth/facebook, I got this error: 当我到达步骤4的结尾以在localhost:3000 / auth / facebook上测试应用程序时,出现了以下错误:

{ 
    "error": {
        "message": "Invalid redirect_uri: Given URL is not allowed by the application configuration.",
        "type": "OAuthException",
        "code": 191
    }
}  

I understand the problem is the URL in the Facebook developer center, but none of the solutions I read works for me... 我了解问题出在Facebook开发人员中心中的URL,但是我阅读的所有解决方案都不适合我...

(I know that there are some questions before regarding this issue, but I'm new to Ruby on Rails and need an explanation for dummies.) (我知道关于此问题之前有一些问题,但是我是Ruby on Rails的新手,并且需要对假人的解释。)

Defining these settings at the Facebook developer center solved this for me: Facebook开发人员中心定义这些设置可以为我解决以下问题:

  • App Domain: (blank) 应用程序域:(空白)

  • Site URL: http://localhost:3000 网站网址: http://localhost:3000

选中网站选项,然后将网站URL设置为http://localhost:3000/

If the Facebook user is being generated in your Ruby on Rails application as 如果在Ruby on Rails应用程序中生成的Facebook用户为

http://localhost:3000/users/auth/facebook

you need configure the Facebook application (Website) under the App section to redirect to 您需要在“应用程序”部分下配置Facebook应用程序(网站)以重定向到

http://localhost:3000/users/auth/facebook/callback

if you are in a production environment, something that i missed was just removing www. 如果您在生产环境中,我想念的只是删除www。 from the site url that you specify in the facebook app settings (settings > basic > Website with Facebook Login > site url). 从您在facebook应用设置中指定的网站网址(设置>基本>具有Facebook登录名的网站>网站网址)。

so instead of http://www.website.com/ you should enter in http://website.com 所以不是http://www.website.com/你应该在进入http://website.com

this worked for me after a few hours of trying to figure out what was wrong and why i was getting this redirect erro. 经过数小时的尝试来弄清楚问题出在哪里以及为什么我得到此重定向错误后,这对我有用。

If you already added a site url you must provide email and turn your app live, you can add email in settings -> basic -> contact email and then make your app live in APP REVIEW -> MAKE "you_app_name" PUBLIC? 如果您已经添加了网站网址,则必须提供电子邮件并启用您的应用,您可以在设置->基本->联系电子邮件中添加电子邮件,然后使应用在APP REVIEW中生效->使“ you_app_name”公开吗? -> yes ->是的

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

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