feat: handle oauth scope verification and errors

This commit is contained in:
Shivam Mishra
2025-06-02 20:17:54 +05:30
parent a7aae69229
commit d0a7de0b00
6 changed files with 129 additions and 4 deletions
+15 -2
View File
@@ -5,10 +5,10 @@ class OauthCallbackController < ApplicationController
redirect_uri: "#{base_url}/#{provider_name}/callback"
)
verify_scopes
handle_response
rescue StandardError => e
ChatwootExceptionTracker.new(e).capture_exception
redirect_to '/'
handle_error(e)
end
private
@@ -63,6 +63,19 @@ class OauthCallbackController < ApplicationController
raise NotImplementedError
end
def verify_scopes
true
end
def failure_redirect_url
'/'
end
def handle_error(exception)
ChatwootExceptionTracker.new(exception).capture_exception
redirect_to failure_redirect_url
end
def create_channel_with_inbox
ActiveRecord::Base.transaction do
channel_email = Channel::Email.create!(email: users_data['email'], account: account)