lib/sinatra/omniauth.rb in sinatra_omniauth-0.1.0 vs lib/sinatra/omniauth.rb in sinatra_omniauth-0.2.0

- old
+ new

@@ -154,10 +154,18 @@ haml :auth end app.get '/auth/:authentication/callback' do + callback + end + + app.post '/auth/:authentication/callback' do + callback + end + + app.send(:define_method, :callback) do # callback: success # This handles signing in and adding an authentication authentication to existing accounts itself # get the authentication parameter from the Rails router authentication_route = params[:authentication] ? params[:authentication] : 'No authentication recognized (invalid callback)' @@ -171,10 +179,10 @@ redirect to('/signin') end # create a new regularised authentication hash @authhash = Hash.new - oaeuh = omniauth['extra']['user_hash'] + oaeuh = omniauth['extra'] && omniauth['extra']['user_hash'] oaui = omniauth['user_info'] if authentication_route == 'facebook' @authhash[:email] = oaeuh['email'] || '' @authhash[:name] = oaeuh['name'] || '' @authhash[:uid] = oaeuh['name'] || ''