Skip to content
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(core): Add support for oauth based service accounts with UM SMTP #7311

Merged
merged 5 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/cli/src/UserManagement/email/NodeMailer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@ export class NodeMailer {
};
}

if (
config.getEnv('userManagement.emails.smtp.auth.serviceClient') &&
config.getEnv('userManagement.emails.smtp.auth.privateKey')
) {
transportConfig.auth = {
type: 'OAuth2',
user: config.getEnv('userManagement.emails.smtp.auth.user'),
serviceClient: config.getEnv('userManagement.emails.smtp.auth.serviceClient'),
privateKey: config
.getEnv('userManagement.emails.smtp.auth.privateKey')
.replace(/\\n/g, '\n'),
};
}

this.transport = createTransport(transportConfig);
}

Expand Down
12 changes: 12 additions & 0 deletions packages/cli/src/config/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,18 @@ export const schema = {
default: '',
env: 'N8N_SMTP_PASS',
},
serviceClient: {
doc: 'SMTP OAuth Service Client',
format: String,
default: '',
env: 'N8N_SMTP_OAUTH_SERVICE_CLIENT',
},
privateKey: {
doc: 'SMTP OAuth Private Key',
format: String,
default: '',
env: 'N8N_SMTP_OAUTH_PRIVATE_KEY',
},
},
sender: {
doc: 'How to display sender name',
Expand Down
Loading