ユーザーがlinkedinを使用してアプリケーションへのログインをキャンセルすることを選択した場合、どのように処理すればよいですか?
キャンセルを押すと、次の URL にリダイレクトされます: localhost:9393/auth/linkedin/callback?oauth_problem=user_refused
次のエラー メッセージが表示されます: OAuth::Problem at /auth/linkedin/callback parameter_absent
Linkedinを使用してログインをキャンセルすることを選択した場合、ユーザーをホームページにリダイレクトしたいだけです。
# ************************************************
# Oauth using Omniauth methods
# ************************************************
%w(get post).each do |method|
send(method, "/auth/:provider/callback") do
"<pre>" + env['omniauth.auth'].inspect + "</pre>"
end
end
ENV['LINKEDIN_CONSUMER_KEY'] = "xxxxxxx"
ENV['LINKEDIN_CONSUMER_SECRET'] = "xxxxxxxx"
use OmniAuth::Builder do
provider :linkedin, ENV['LINKEDIN_CONSUMER_KEY'], ENV['LINKEDIN_CONSUMER_SECRET'], :scope => 'r_fullprofile+r_emailaddress+r_network', :fields => ["id", "email-address", "first-name", "last-name", "headline", "industry", "picture-url", "public-profile-url", "location", "connections"]
end
get '/auth/failure' do
flash[:notice] = params[:message] # if using sinatra-flash or rack-flash
redirect '/'
end