module Sorcery::Model::Submodules::External::InstanceMethods
Public Instance Methods
add_provider_to_user(provider, uid)
click to toggle source
# File lib/sorcery/model/submodules/external.rb, line 95 def add_provider_to_user(provider, uid) authentications = sorcery_config.authentications_class.name.demodulize.underscore.pluralize # first check to see if user has a particular authentication already if sorcery_adapter.find_authentication_by_oauth_credentials(authentications, provider, uid).nil? user = send(authentications).build(sorcery_config.provider_uid_attribute_name => uid, sorcery_config.provider_attribute_name => provider) user.sorcery_adapter.save(validate: false) else user = false end user end