-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: Support for Microsoft Oauth in Email Channel #6227
Conversation
…d imap search update
✅ Deploy Preview for chatwoot-storybook ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
|
||
@response = client.auth_code.get_token( | ||
oauth_code, | ||
redirect_uri: "#{base_utl}/microsoft/callback" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redirect_uri: "#{base_utl}/microsoft/callback" | |
redirect_uri: "#{base_url}/microsoft/callback" |
inbox = create_inbox | ||
::Redis::Alfred.delete(permitted_params['current_account_id']) | ||
# ::microsoft::WebhookSubscribeService.new(inbox_id: inbox.id).perform | ||
redirect_to app_twitter_inbox_agents_url(account_id: account.id, inbox_id: inbox.id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let us rename this path.
@@ -249,6 +249,8 @@ GEM | |||
gli (2.21.0) | |||
globalid (1.0.0) | |||
activesupport (>= 5.0) | |||
gmail_xoauth (0.4.2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tejaswinichile net::imap latest versions support xoauth automatically. We can upgrade the package. No need to do it in this PR. We can take it as a separate task.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving to "request changes" status so that we don't accidently merge this PR.
.env.example
Outdated
#MS OAUTH creds | ||
AZURE_APP_ID= | ||
AZURE_APP_SECRET= | ||
AZURE_SCOPES = 'Mail.Send offline_access https://graph.microsoft.com/IMAP.AccessAsUser.All https://graph.microsoft.com/SMTP.Send' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tejaswinichile Why do we need to take this as an env variable?
def perform | ||
Channel::Email.where(provider: 'microsoft').each do |channel| | ||
# refresh the token here, with microsoft offline_access scope | ||
provider_config = channel.provider_config || {} | ||
|
||
refresh_tokens(channel, provider_config.with_indifferent_access) if provider_config[:refresh_token].present? | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's move this to services
instead. since we won't be using the perform block nor need to inherit the application job. We only need the access_token method, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right! makes sense 👍🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- refactored the refresh token service a bit and added some addition specs.
- noted that specs for callbacks controller is missing
@@ -53,6 +53,10 @@ | |||
"ENABLE": "Create conversations from mentioned Tweets" | |||
} | |||
}, | |||
"MICROSOFT": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be a part of the frontend PR ?
…ot/chatwoot into feat/microsoft-oauth-apis
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
https://www.loom.com/share/e930184057d549da813f97bc66fff390