我正在尝试关注此链接以帮助将linkedin gem 与omniauthable 设计Rails 平台集成。
http://renderedtext.com/blog/2011/08/17/how-to-use-linkedin-gem-with-omniauth/
两个快速的问题!
底部的“LinkedinFactory 类”文件将位于应用程序中的什么位置,它会被称为什么?我在上面的链接中没有看到目录/文件名。
当我尝试通过linkedin登录时,我的应用程序当前失败:
OmniauthCallbacksController#linkedin 中的 NoMethodError
nil:NilClass 的未定义方法“create_linkedin_connection”
我将在哪里以及如何定义“create_linkedin_connection”方法?它在 omniauth_callbacks.rb 控制器的第 3 行中调用:
def linkedin
omniauth_hash = env["omniauth.auth"]
current_user.create_linkedin_connection(
:token => omniauth_hash["extra"]["access_token"].token,
:secret => omniauth_hash["extra"]["access_token"].secret,
:uid => omniauth_hash["uid"]
)
redirect_to root_path, :notice => "You've successfully connected your LinkedIn account."
end
谢谢!