Sha256: bfc60a641ad3657616067a8ae728223c4b91df7d8e07b4288e32c5a58c34cfaa
Contents?: true
Size: 1.19 KB
Versions: 8
Compression:
Stored size: 1.19 KB
Contents
Doorkeeper.configure do orm :active_record use_refresh_token api_only skip_client_authentication_for_password_grant { true } if defined?(skip_client_authentication_for_password_grant) resource_owner_authenticator { current_spree_user } resource_owner_from_credentials do user = Spree.user_class.find_for_database_authentication(email: params[:username]) next if user.nil? if defined?(Spree::Auth::Config) && Spree::Auth::Config[:confirmable] == true user if user.active_for_authentication? && user.valid_for_authentication? { user.valid_password?(params[:password]) } elsif user&.valid_for_authentication? { user.valid_password?(params[:password]) } user end end admin_authenticator do |routes| current_spree_user&.has_spree_role?('admin') || redirect_to(routes.root_url) end grant_flows %w(password) access_token_methods :from_bearer_authorization, :from_access_token_param end Doorkeeper::AccessGrant.class_eval do self.table_name = 'spree_oauth_access_grants' end Doorkeeper::AccessToken.class_eval do self.table_name = 'spree_oauth_access_tokens' end Doorkeeper::Application.class_eval do self.table_name = 'spree_oauth_applications' end
Version data entries
8 entries across 8 versions & 1 rubygems