问题描述
我工作的实施omniauth到Rails项目。我的问题是认证供应商 - 微博,谷歌,Facebook等,都需要我创造与来自不同于URL其他任何地方限制认证请求的URL的应用程序。我需要能够在本地测试也运行在生产中code,但Facebook例如不允许2域,不允许本地主机进不去。
I'm working on implementing omniauth into a Rails project. My problem is that the authentication providers - Twitter, Google, Facebook etc all require me to create an application with a url that limits authentication requests from anywhere other than the url. I need to be able to to test locally but also run code in production, but Facebook for example doesn't allow 2 domains and doesn't allow localhost anyhow.
所以,我有哪些选择?
推荐答案
在工作中,我们有多个应用程序设置为不同的环境。当地,加入进入/ etc / hosts中
(假设你是在Linux上)例如:127.0.0.1 mydomain.local
。
At work, we have multiple applications setup for the different environments. On local, add an entry in /etc/hosts
(assuming you are on linux) eg: 127.0.0.1 mydomain.local
.
在Facebook应用程序设置为当地的环境,添加此作为URL。大多数事情,除非Facebook需要刮你的网站(比如按钮)的工作。
On the facebook app setup for the local environment, add this as the url. Most things, except where facebook needs to scrape your site (Like buttons) work.
这篇关于制作与Facebook /谷歌API的本地开发工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!