ユーザーの情報へのアクセス許可を要求する URL にユーザーをリダイレクトしようとしています。
アクションが次のフォームのビューがあります。
class AuthController < ApplicationController
def auth
@oauth = Koala::Facebook::OAuth.new("*id*", "*secret*", 'http://localhost:3000/auth/auth2')
address = @oauth.url_for_oauth_code(:permissions => "publish_stream")
puts "address #{address}"
redirect_to address
return
end
def auth2
end
end
ではstdout
、住所は次のように表示されます。Redirected to https://graph.facebook.com/oauth/authorize?client_id=*id*&redirect_uri=http://localhost:3000/auth/auth2&scope=publish_stream
この URL を (アプリではなく) ブラウザーにスタンドアロンで入力すると、アプリがアクセス許可を要求する正しいページに移動します。ただし、アプリケーションを介して、アクセス許可を要求するページではなく、Facebook のロゴを表示するページに移動します。
アクセス許可ページが表示されることを期待していましたが、ユーザーが許可すると、リクエストがredirect_uriに転送されます。