1

我正在尝试连接 fitbit api。我正在尝试学习 Oauth on Rails

设备/控制器

def create
  device = request.env["omniauth.auth"]       
  current_user.devices.find_or_create_by_provider_and_oauth_token_and_oauth_verifier(device['provider'], device['oauth_token'], device["oauth_verifier"])
  flash[:notice] = "Device Successfully connected."
  redirect_to devices_url
end

因此,我使用我的凭据向 fitbit 打电话,要求提供用户令牌和验证器。我收到了参数:

{"oauth_token"=>"1c...d7e",

"oauth_verifier"=>"li...i5", "provider"=>"fitbit"}

并收到错误:

ActiveRecord::DangerousAttributeError in DevicesController#create

有想法该怎么解决这个吗?谢谢

4

0 回答 0