【问题标题】:OmniAuth facebook with Devise in Ruby on rails not passing app_idOmniAuth facebook 在 Ruby on rails 中使用 Devise 不通过 app_id
【发布时间】:2015-06-23 12:01:41
【问题描述】:

我正在使用 Devise 设置一个 Rails 应用程序 (4.1.10)。我正在使用此设计指南添加 OmniAuth Facebook 集成:https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview

我认为我已经设置了我应该设置的所有内容(我知道我应该将 app_id 和 secret 放入 ENV 变量 - 一旦这工作我将继续使用它)但是当我点击我的登录 facebook 链接时出现错误:

https://www.facebook.com/dialog/oauth?client_id=&display=popup&redirect_uri=http%3A%2F%2Fwww.clazzoo.com%2Fusers%2Fauth%2Ffacebook%2Fcallback&response_type=code&scope=email%2Cuser_birthday%2Cread_stream&state=b43008b5d8e714e91ac37b4410f7758655efecbca7bfe98e

Warning
The parameter app_id is required

配置在这里:

    # Use this hook to configure devise mailer, warden hooks and so forth.
    # Many of these configuration options can be set straight in your model.
    Devise.setup do |config|
     ...
    ...

    config.omniauth :facebook, "1602932433319776", "7221cf917c6e55ba68c8e81145994481",
      :scope => 'email,user_birthday,read_stream',
      :display => 'popup'

    config.omniauth :stripe_connect,
    Settings.stripeConnectClientID,
    Settings.stripeSecretKey,
    :scope => 'read_write',
    :stripe_landing => 'register'
  end

User 模型具有omniauthable 集:

class User < ActiveRecord::Base
  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable, :confirmable,
         :omniauthable, :omniauth_providers => [:facebook]

那么为什么当我点击我的链接时会错过相应的 ID?

【问题讨论】:

  • 您是否将您的ENV 变量添加到~/.bashrc
  • 我在开发时没有在此测试中使用 ENV 变量 - 它们是硬编码的......根据问题中的代码示例

标签: ruby-on-rails ruby-on-rails-4 devise omniauth omniauth-facebook


【解决方案1】:

我不确定是什么损坏了——结果是我将我的代码重新提交到 heroku 并重新启动 heroku 来修复它。简单;)

【讨论】:

  • 就这样?我得到了同样的错误,虽然所有的变量都是硬编码的
  • 是的,这就是它的全部内容......我不再使用 Heroku,所以无法进一步帮助你!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-09-08
  • 2017-11-14
  • 2015-03-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-02-14
相关资源
最近更新 更多