I am using Rails 3. I am getting a Rack::OAuth2::Client::Error in SessionsController#create error when I try to get the access key. I used omniauth to login to facebook and I am getting the param["code"] Now I try to use fbgraph to get the access code and I am getting the Rac::OAuth2::Client::Error.
def create
auth=request.env["omniauth.auth"]
fb_auth=FbGraph::Auth.new("xxxxxxx", "xxxxxxxxxxxxxxxxxxxxxxxxxxx")
client=fb_auth.client
client.redirect_uri="http://localhost:3000/facebook/callback/"
client.authorization_code=params[:code]
access_token = client.access_token! # => Rack::OAuth2::AccessToken
user=User.find_by_provider_and_uid(auth["provider"], auth["id"]) ||User.create_with_omniauth(auth, access_token)
session[:user_id]=user.id
redirect_to root_url, :notice => "Signed In!"
end
The access_token! 其一行是,该错误正在回归。