Last active
November 17, 2022 12:35
-
-
Save maxloncar/b788deb1c41cc2073a790e1b62731ae9 to your computer and use it in GitHub Desktop.
Devise initializer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/initializers/devise.rb | |
class TurboFailureApp < Devise::FailureApp | |
def respond | |
if request_format == :turbo_stream | |
redirect | |
else | |
super | |
end | |
end | |
def skip_format? | |
%w(html turbo_stream */*).include? request_format.to_s | |
end | |
end | |
Devise.setup do |config| | |
# ==> Controller configuration | |
config.parent_controller = 'TurboController' | |
# ==> Navigation configuration | |
config.navigational_formats = ['*/*', :html, :turbo_stream] | |
# ==> OmniAuth | |
config.omniauth :microsoft_office365, ENV['OFFICE365_KEY'], ENV['OFFICE365_SECRET'], callback_path: "/auth/microsoft_office365/callback" | |
config.warden do |manager| | |
manager.failure_app = TurboFailureApp | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment