2013-07-10 180 views
0

我的應用程序使用ruby在rails上製作,使用omniauth和omniauth-facebook寶石。它包含一個'用Facebook登錄'按鈕。它在localhost中工作正常 - 人們可以使用Facebook登錄 - 但我無法在我的活動服務器上運行。據我所知,我已經改變了相關的細節,但是有什麼我錯過了?ruby​​ on rails omniauth和omniauth-facebook

正如我所說的,它在localhost:3000中正常工作。我已經改變了這些細節,試圖讓它在www.example.com的工作,但我不斷收到錯誤消息:

Given URL is not permitted by the application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains. 

在我的配置/ oauth.yml文件我有:

development: 
    facebook: 
    app_id: "12345" 
    app_secret: "abcde" 
    options: 
     scope: "email" 
     display: "page" 

staging: &staging 
    facebook: 
    app_id: "12345" 
    app_secret: "abcde" 
    options: 
     scope: "email" 
     display: "page" 

test: 
    <<: *staging 

production: 
    facebook: 
    app_id: "12345678" 
    app_secret: "abcdefgh" 

我已經更改了'製作'中的app_id和app_secret,以匹配我在Facebook中創建的應用程序的ID和祕密。

在環境/ production.rb我已經把:

# Need this here for mailing purposes 
    config.action_mailer.default_url_options = { :host => 'www.example.com' } 

在環境/ development.rb我已經把:

# Don't care if the mailer can't send 
    config.action_mailer.raise_delivery_errors = true 
    config.action_mailer.default_url_options = { :host => 'www.example.com' } 

我俯瞰的東西嗎?也許我需要改變我的Facebook Apps部分,它給了我身份和祕密?任何幫助,將不勝感激。

+0

什麼是您的應用程序域設置?它是'example.com'嗎? –

+0

在Facebook上它說'應用程序域名'我有www.example.com。 – CHarris

+0

而在'與Facebook登錄網站,網站地址:'我有http://www.example.com/ – CHarris

回答

0

在與Facebook登錄網站網址網站應該設置爲你的網站的網址,並在應用程序域設置爲您的主機,例如:

應用程序域:: example.com

網站網址:http://example.com/

而在environments/production.rb你應該把:

config.action_mailer.default_url_options = { :host => 'example.com' } 
+0

乾杯,謝謝。雖然仍然無法讓它工作。我將App Domain和Site Url完全按照描述。還有什麼可能呢?我不斷收到那條消息,'給定的URL是不允許的應用程序配置....'你可以在這裏看到它,點擊Facebook按鈕.http://populisto.com/login – CHarris

+0

@ChristopheHarris嘿,你有沒有想出解決辦法? – chamini2

+0

@ chamini2是的,我做了,但不記得如何。無論如何,我已經在rails4和ruby2中重建了我的項目。這些教程非常有用 - https://coderwall.com/p/bsfitw和https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview – CHarris

0

同樣的事情是發生在我身上時,我把所有的集正確完成。在我的Facebook控制面板上發現App ID和App Secret在某種程度上改變了方向。您可能在儀表板上進行了更改,以某種方式更改了ID和Secret.Just再次確認這些詳細信息