Skip to content

feat: implement Oauth2 transport creation in SMTPMailService - #1729

Open
gnyiri wants to merge 18 commits into
developfrom
feat_smtp_app_token
Open

feat: implement Oauth2 transport creation in SMTPMailService#1729
gnyiri wants to merge 18 commits into
developfrom
feat_smtp_app_token

Conversation

@gnyiri

@gnyiri gnyiri commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

At ELI we move from SMTP basic auth to Oauth2.

Add Oauth2 transport creation in SMTP Mail Service.

See above.

How Has This Been Tested

Manual tests + backend tests.

Fixes

N/A

Changes

SMTP Mail Service.

Depends on

N/A

Tests included/Docs Updated?

  • I have added tests to cover my changes.
  • All relevant doc has been updated

@gnyiri
gnyiri requested a review from a team as a code owner August 18, 2026 09:29
@gnyiri
gnyiri requested review from simonfernandes and removed request for a team August 18, 2026 09:29

@jekabs-karklins jekabs-karklins left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @gnyiri ,

I have verified that the changes in this PR still works fine in our development environment and emails are properly sent out👍🏻

I have added two comments that would be very nice to address before merging in.

Comment thread apps/backend/package.json Outdated
Comment thread apps/backend/src/eventHandlers/MailService/SMTP/SMTPMailService.ts Outdated
@yoganandaness
yoganandaness requested review from mutambaraf and zacharyjhankin and removed request for yoganandaness August 26, 2026 12:17
@gnyiri
gnyiri requested a review from jekabs-karklins August 27, 2026 07:27
}

private async createTransport() {
if (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can have a env like USE_SMTP_OAUTH_2 so that its easier and more straight forward to switch between the two.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, good idea

@mutambaraf mutambaraf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just also did a manual email check and our emails are not being send on my local machine .Having error "{"error":{"code":"ESOCKET","command":"CONN"}".

Comment on lines +129 to +131
if (!this.authToken?.expiresOn) {
throw new Error('Invalid token: Missing expiresOn property');
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can do this check when we set authToken " this.authToken = await cca.acquireTokenByClientCredential(tokenRequest);

if (!this.authToken || !this.authToken.accessToken) {
  throw new Error('Failed to get access token');
}"

Comment thread apps/backend/src/eventHandlers/MailService/SMTP/SMTPMailService.ts Outdated

@jekabs-karklins jekabs-karklins left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good from my side but @mutambaraf has some more good comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants