2

我将 Rails 应用程序的暂存版本部署到 Heroku,我正在使用 Devise gem,并且在/config/initializers/devise.rb中存储凭据,如下所示:

# production
  config.omniauth :facebook, '11', '22',
      :site              => 'https://graph.facebook.com',
      :authorize_path    => '/oauth/authorize',
      :access_token_path => '/oauth/access_token',
      :scope => 'email, publish_stream, read_friendlists'

  # staging
  config.omniauth :facebook, '33', '44',
      :site              => 'https://graph.facebook.com',
      :authorize_path    => '/oauth/authorize',
      :access_token_path => '/oauth/access_token',
      :scope => 'email, publish_stream, read_friendlists'
  # localhost
  config.omniauth :facebook, '55', '66',
      :site              => 'https://graph.facebook.com',
      :authorize_path    => '/oauth/authorize',
      :access_token_path => '/oauth/access_token',
      :scope => 'email, publish_stream, read_friendlists'

本地主机和生产运行良好,但暂存版本不是。我在 Facebook 管理中使用与生产和暂存版本完全相同的设置,但暂存版本仍然返回此错误消息:

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

它让我发疯,因为它在 2 个环境中有效,但在第 3 个环境(用于暂存)中无效。有什么提示可能是错的吗?

4

0 回答 0