Sha256: e8bc174d22899efbddfa2366b4e0a3db2f8cec78cc8a8d50a1965c9ab99025fe
Contents?: true
Size: 1.54 KB
Versions: 3
Compression:
Stored size: 1.54 KB
Contents
=============================================================================== Some setup you must do manually if you haven't yet: 1. configure your User model (mongo_mapper example): class User ... key :auth_keys, Array def self.authenticate(fields) auth_key = "#{fields["provider"]}_#{fields["uid"]}" user = User.first(:auth_keys => auth_key) if user.nil? user = User.new(:auth_keys => [auth_key]) user.send(:auth_fields=, fields["user_info"]) user.save! end user end def connect(fields) auth_key = "#{fields["provider"]}_#{fields["uid"]}" user = User.first(:auth_keys => auth_key, :select => [:id]) if user.present? && user.id != self.id user.destroy if merge_account(user) end self.push_uniq(:auth_keys => auth_key) end def merge_account(other_user) # return true to delete the old user true end def auth_fields=(info) Rails.logger.info "FIELDS: #{info.inspect}" info.each_pair do |k, v| self[k] = v end end end 2. configure the service keys at config/auth_providers.yml Default routes: /sessions/sign_in /sessions/sign_out you can override them using the following routes: match "/login" => "multiauth/sessions#new", :as => :new_session match "/logout" => "multiauth/sessions#destroy", :method => :get, :as => :destroy_session ===============================================================================
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
multiauth-0.2.5 | lib/generators/templates/README |
multiauth-0.2.2 | lib/generators/templates/README |
multiauth-0.2.1 | lib/generators/templates/README |