我向Heroku部署了Rails应用程序的暂存版本,我正在使用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'
Localhost和生产运行良好,但暂存版本不行。我在Facebook管理中使用与生产和登台版本完全相同的设置,但是暂存版本仍然返回此错误消息:
{
"error": {
"message": "Invalid redirect_uri: Given URL is not allowed by the Application configuration.",
"type": "OAuthException",
"code": 191
}
}
它让我发疯,因为在2个环境中它正在工作,但不适用于第三个环境(用于分期)。什么提示可能是错的?