当用户选择取消使用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