app/controllers/devise_token_auth/omniauth_callbacks_controller.rb
def user_exists_with_other_providers
      @resource = @resource.class.find_by_phone(@resource.phone)

      # sync user info with provider, update/generate auth token
      assign_provider_attrs(@resource, auth_hash)

      # assign any additional (whitelisted) attributes
      extra_params = whitelisted_params
      @resource.assign_attributes(extra_params) if extra_params

      create_token_info
      set_token_on_resource
      create_auth_params

      if resource_class.devise_modules.include?(:confirmable)
        @resource.skip_confirmation!
      end

      sign_in(:user, @resource, store: false, bypass: false)
      @resource.save!

      yield @resource if block_given?

      render_data_or_redirect('deliverCredentials', @auth_params.as_json, @resource.as_json)
    end
# RecordNotUnique is thrown when the phone has already been used with another
# provider, sign that user in since we know the user own the phone through
# their provider.
RecordNotUnique is thrown when the phone has already been used with another
provider, sign that user in since we know the user own the phone through
their provider.
RecordNotUnique is thrown when the phone has already been used with another provider sign that user in since we know the user own the phone through their provider .
def user_exists_with_other_providers
      @resource = @resource.class.find_by_phone(@resource.phone)
      assign_provider_attrs(@resource, auth_hash)
      extra_params = whitelisted_params
      @resource.assign_attributes(extra_params) if extra_params
      create_token_info
      set_token_on_resource
      create_auth_params
      if resource_class.devise_modules.include?(:confirmable)
        @resource.skip_confirmation!
      end
      sign_in(:user, @resource, store: false, bypass: false)
      @resource.save!
      yield @resource if block_given?
      render_data_or_redirect('deliverCredentials', @auth_params.as_json, @resource.as_json)
    end
def user_exists_with_other_providers @resource = @resource . class . find_by_phone ( @resource . phone ) assign_provider_attrs ( @resource , auth_hash ) extra_params = whitelisted_params @resource . assign_attributes ( extra_params ) if extra_params create_token_info set_token_on_resource create_auth_params if resource_class . devise_modules . include? ( :confirmable ) @resource . skip_confirmation! end sign_in ( :user , @resource , store : false , bypass : false ) @resource . save! yield @resource if block_given? render_data_or_redirect ( 'deliverCredentials' , @auth_params . as_json , @resource . as_json ) end
RecordNotUnique is thrown when the phone has already been used with another
provider, sign that user in since we know the user own the phone through
their provider.
RecordNotUnique is thrown when the phone has already been used with another provider sign that user in since we know the user own the phone through their provider .
# sync user info with provider, update/generate auth token # assign any additional (whitelisted) attributes