LinkedIn Ruby Gemを使用していますが、問題が発生しています。これが私のレールサーバーからの出力です。
Started GET "/session/callback?oauth_token=618b3bc2-d8f6-4c9c-99a2-10573c8b3c3c&oauth_verifier=09858" for 127.0.0.1 at Tue Jun 12 19:14:11 -0700 2012
Processing by SessionController#callback as HTML
Parameters: {"oauth_verifier"=>"09858", "oauth_token"=>"618b3bc2-d8f6-4c9c-99a2-10573c8b3c3c"}
Completed 500 Internal Server Error in 163ms
OAuth::Problem (token_rejected):
app/controllers/session_controller.rb:28:in `callback'
Rendered /Library/Ruby/Gems/1.8/gems/actionpack-3.2.3/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.2ms)
Rendered /Library/Ruby/Gems/1.8/gems/actionpack-3.2.3/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.0ms)
Rendered /Library/Ruby/Gems/1.8/gems/actionpack-3.2.3/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (12.9ms)
これが私の session_controller.rb のコードです:
require 'linkedin'
class SessionController < ApplicationController
def login
# get your api keys at https://www.linkedin.com/secure/developer
client = LinkedIn::Client.new(APP_CONFIG['linkedin']['apikey'], APP_CONFIG['linkedin']['secret_key'])
request_token = client.request_token(:oauth_callback =>
"http://#{request.host_with_port}/session/callback")
session[:rtoken] = request_token.token
session[:rsecret] = request_token.secret
redirect_to client.request_token.authorize_url
end
def logout
session[:atoken] = nil
redirect_to :root
end
def callback
client = LinkedIn::Client.new(APP_CONFIG['linkedin']['apikey'], APP_CONFIG['linkedin']['secret_key']) # "your_api_key", "your_secret")
if session[:atoken].nil?
pin = params[:oauth_verifier]
atoken, asecret = client.authorize_from_request(session[:rtoken], session[:rsecret], pin)
session[:atoken] = atoken
session[:asecret] = asecret
else
client.authorize_from_access(session[:atoken], session[:asecret])
end
redirect_to '/users/index'
end
end
ランダム アクセスの問題もあります。そのエラーは次のとおりです。
Access Denied
You don't have permission to access "/D/16382/14334/000/origin.wwwapps.ups.com/uas/oauth/authorize?oauth_token=730c3a62-08ad-4ac2-9281-c9e67bb3a2d5" on this server.
Reference #18.6fd054b8.1339554485.72cbb3