Web アプリケーションで Yahoo ファンタジー スポーツ API を使用したいのですが、そのために Yahoo ログインに OAuth を使用しています。コンシューマーキーとシークレットキーがあり、次のコードを実行すると、キーが正常に渡されました。Yahoo ログインにリダイレクトし、ユーザーの資格情報にアクセスする許可を求めます。AGREE を指定すると、ページはhttps://api.login.yahoo.com/oauth/v2/request_authにリダイレクトされ、検証コードが表示されます。認証コードのページで閉じるボタンを押しても自分のURLにコールバックされません。
@ts=Time.now.to_i
@callback_url = "http://localhost:3000/callback"
@nonce = SecureRandom.hex()
consumer = OAuth::Consumer.new("my consumerkey","secret key",
{ :site => 'https://api.login.yahoo.com',
:http_method => :post,
:scheme => :header,
:oauth_nonce => @nonce,
:request_token_path => '/oauth/v2/get_request_token',
:authorize_path => '/oauth/v2/request_auth',
:access_token_path => '/oauth/v2/get_token',
:oauth_callback => "http://localhost:3000/callback",
:oauth_timestamp => Time.now.to_i,
:oauth_signature_method => "HMAC-SHA-1",
:oauth_version => "1.0",
:oauth_callback_confirmed => true,
})
request_token = consumer.get_request_token
session[:request_token]=request_token
redirect_to request_token.authorize_url
access_token=request_token.get_access_token
access = ActiveSupport::JSON.decode(access_token.to_json)
if !(access.present?)
@response = "Response failed"
else
@response = access
end
access_token を取得するためのコールバックを取得するために行う変更を教えてください。