【发布时间】:2015-01-08 09:30:40
【问题描述】:
我正在使用我的 rails 4 应用程序。我使用 Facebook、LinkedIn 和电子邮件进行身份验证。
我刚刚开始使用 Figaro,我对代码所做的唯一更改是将用于我的电子邮件帐户的密码从 production.rb 交换到我的 application.yml 文件中。
现在,当我测试 LinkedIn 注册链接时,我收到一条错误消息,指出出现问题(在按“注册 LinkedIn”后)。当我尝试使用其他选项进行身份验证时,我得到了同样的错误。
我的全域身份验证回调控制器中的linkedin 出现回调错误。问题所在的行是下面的“@user.send_admin_email”:
def linkedin
@user = User.find_for_linkedin_oauth(request.env["omniauth.auth"])
if @user.persisted?
@user.send_admin_mail
redirect_to root_path, :event => :authentication
# sign_in_and_redirect @user, :event => :authentication #this will throw if @user is not activated
# set_flash_message(:notice, :success, :kind => "LinkedIn") if is_navigational_format?
else
session["devise.linkedin_data"] = request.env["omniauth.auth"]
redirect_to root_path
end
end
我设置了一个邮件程序,它会向我发送一封电子邮件,告诉我何时有新的注册。它使用我将密码从 production.rb 移动到 application.yml 的电子邮件地址
有谁知道如何解决这个错误?
非常感谢
【问题讨论】:
-
在生产环境中,您需要将密钥传递给生产服务器。例如,你可以使用 figaro 和 heroku:
figaro heroku:set -e production -
您好,感谢您的提示。我不确定我应该在哪里尝试这个?我应该在 production.rb 文件中的 config.action_mailer.smtp_settings 中添加一行吗?谢谢
标签: ruby-on-rails devise linkedin