Module: Sorcery::Model::Submodules::External
- Defined in:
- lib/sorcery/model/submodules/external.rb
Overview
This submodule helps you login users from external providers such as Twitter. This is the model part which handles finding the user using access tokens. For the controller options see Sorcery::Controller::External.
Socery assumes (read: requires) you will create external users in the same table where you keep your regular users, but that you will have a separate table for keeping their external authentication data, and that that separate table has a few rows for each user, facebook and twitter for example (a one-to-many relationship).
External users will have a null crypted_password field, since we do not hold their password. They will not be sent activation emails on creation.
Defined Under Namespace
Modules: ClassMethods, InstanceMethods
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/sorcery/model/submodules/external.rb', line 17 def self.included(base) base.sorcery_config.class_eval do attr_accessor :authentications_class, :authentications_user_id_attribute_name, :provider_attribute_name, :provider_uid_attribute_name end base.sorcery_config.instance_eval do @defaults.merge!(:@authentications_class => nil, :@authentications_user_id_attribute_name => :user_id, :@provider_attribute_name => :provider, :@provider_uid_attribute_name => :uid) reset! end base.send(:include, InstanceMethods) base.extend(ClassMethods) end |