Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 5, 2026

Implementation Plan: Google Workspace OAuth 2.0 Email Support

Phase 1: Configuration Setup ✅

  • Add new config keys to config-definition.ts for OAuth 2.0 credentials
    • Add mail:oauth2ClientId config
    • Add mail:oauth2ClientSecret config
    • Add mail:oauth2RefreshToken config
    • Add mail:oauth2User config (email address of the authorized account)
    • Update mail:transmissionMethod type to include 'oauth2'

Phase 2: Update Mail Service ✅

  • Update mail.ts to support OAuth 2.0 authentication
    • Create createOAuth2Client() method
    • Update initialize() to handle 'oauth2' transmission method
    • Ensure nodemailer OAuth 2.0 configuration is correct

Phase 3: API Routes ✅

  • Add OAuth 2.0 settings endpoints in app-settings/index.ts
    • Add GET endpoint for OAuth 2.0 settings
    • Add PUT endpoint for updating OAuth 2.0 settings
    • Add validation for OAuth 2.0 parameters
    • Add ACTION_ADMIN_MAIL_OAUTH2_UPDATE to activity tracking

Phase 4: Frontend Components ✅

  • Create OAuth 2.0 settings component
    • Add OAuth2Setting.tsx component
    • Update MailSetting.tsx to include OAuth 2.0 option
    • Update AdminAppContainer to handle OAuth 2.0 state
    • Add translations for all languages (English, Japanese, French, Korean, Chinese)

Phase 5: Testing & Validation ✅

  • Code review completed
  • Apply code formatting
  • Verify configuration structure
  • Add translations for all supported languages
  • Fix lint errors (removed unused React import, applied biome formatting)

Summary

This implementation adds OAuth 2.0 authentication support for sending emails using Google Workspace accounts. The feature is fully integrated into the admin settings UI and follows the existing patterns for SMTP and SES configuration.

Translations Added:

  • ✅ English (en_US)
  • ✅ Japanese (ja_JP)
  • ✅ French (fr_FR)
  • ✅ Korean (ko_KR)
  • ✅ Chinese (zh_CN)

Lint Fixes:

  • ✅ Removed unused React import from MailSetting.tsx
  • ✅ Applied biome formatting to config-definition.ts and mail.ts

How to Use:

  1. Navigate to Admin Settings → Mail Settings
  2. Select "OAuth 2.0 (Google Workspace)" as the transmission method
  3. Configure the following:
    • Email Address: The authorized Google account email
    • Client ID: OAuth 2.0 Client ID from Google Cloud Console
    • Client Secret: OAuth 2.0 Client Secret
    • Refresh Token: OAuth 2.0 Refresh Token obtained from authorization flow
  4. Save the settings

The implementation uses nodemailer's built-in Gmail OAuth 2.0 support, which handles token refresh automatically.

Original prompt

Start implementation

[Chronological Review: The conversation began with a user request to implement email sending functionality using Google Workspace accounts, specifically mentioning the transition from username/password authentication to OAuth 2.0. The user highlighted the need to modify the `mail.ts` service file and check the version of the `nodemailer` library. The user also indicated that configuration values would need to be added to the `config-definition.ts` file. Following this, the user requested to save the plan to "serena memories" with a specific filename format. The user then canceled a previous command to delegate to a background agent and finally requested to start the implementation.]

[Intent Mapping:

  • "Google Workspace のアカウントを使ってメール送信する機能を実装したい" - User wants to implement email sending functionality using Google Workspace accounts.
  • "nodemailer は最新バージョンだろうか?" - User wants to check if the current version of nodemailer is up to date.
  • "計画を serena memories に保存してください" - User requests to save the plan with a specific filename format.
  • "Cancel: 'Delegate to Background Agent'" - User cancels a previous command.
  • "Start implementation" - User initiates the implementation process.]

[Technical Inventory:

  • nodemailer: A library for sending emails in Node.js, which supports OAuth 2.0.
  • OAuth 2.0: The authentication method required for sending emails through Google Workspace accounts.
  • Files Mentioned:
    • mail.ts: Service layer file for email functionality.
    • config-definition.ts: Configuration file where mail settings will be updated.]

[Code Archaeology:

  • File: mail.ts: This file will be modified to implement email sending functionality using OAuth 2.0.
  • File: config-definition.ts: This file will have new configuration values added for mail settings.]

[Progress Assessment:

  • Completed Tasks: User has outlined the requirements for implementing email functionality and identified necessary files for modification.
  • Partially Complete Work: The actual implementation has not yet begun but has been initiated with the last command.]

[Context Validation: All critical information for continuation is captured, including the need for OAuth 2.0 implementation and the specific files to be modified.]

[Recent Commands Analysis:

  • Last Agent Commands: User requested to "Start implementation."
  • Tool Results Summary: No specific tool results were returned as the implementation process was just initiated.
  • Pre-Summary State: The agent was preparing to start the implementation of the email functionality using OAuth 2.0.
  • Operation Context: The commands executed were directly related to the user's goal of implementing email sending functionality using Google Workspace accounts.]
1. Conversation Overview: - Primary Objectives: User wants to implement email sending functionality using Google Workspace accounts, specifically using OAuth 2.0 instead of username/password authentication. - Session Context: The conversation flowed from outlining the requirements for the email functionality to discussing necessary modifications in specific files and finally initiating the implementation. - User Intent Evolution: The user moved from requesting information and planning to actively starting the implementation process.
  1. Technical Foundation:
  • nodemailer: Latest version to be confirmed; used for sending emails with OAuth 2.0 support.
  • OAuth 2.0: Required authentication method for Google Workspace email sending.
  • Files Mentioned:
    • mail.ts: Service layer for email functionality.
    • config-definition.ts: Configuration file for mail settings.
  1. Codebase Status:
  • File: mail.ts:
    • Purpose: Implement email sending functionality.
    • Current State: To be modified for OAuth 2.0 support.
  • File: config-definition.ts:
    • Purpose: Update mail settings.
    • Current State: New configuration values to be added.
  1. Problem Resolution:
  • Issues Encountered: Transition from username/password to OAuth 2.0 for email sending.
  • Solutions Implemented: User has outlined the need for OAuth 2.0 and identified necessary files for modification.
  • Debugging Context: No ongoing issues reported; focus is on implementation.
  • Lessons Learned: Understanding of the need for OAuth 2.0 in modern email sending practices.
  1. Progress Tracking:
  • Completed Tasks: User has defined requirements and identified files for modification.
  • Partially Complete Work: Implementation has just started.
  • Validated Outcomes: None yet, as implementation is in the initial stage.
  1. Active Work State:
  • Current Focus: Starting the implementation of email functionality using OAuth 2.0.
  • Recent Context: User has just requested to start the implementation after outlining the requirements.
  • Working Code: No specific code snippets discussed recently as the implementation has just begun.
  • Immediate Context: User is focused on implementing the email sending...

Created from VS Code.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Add email sending functionality using Google Workspace accounts Add OAuth 2.0 authentication for Google Workspace email sending Jan 5, 2026
Copilot AI requested a review from yuki-takei January 5, 2026 13:49
@yuki-takei yuki-takei changed the title Add OAuth 2.0 authentication for Google Workspace email sending feat: Add OAuth 2.0 authentication for Google Workspace email sending Jan 6, 2026
@yuki-takei
Copy link
Contributor

@copilot public/static/locales 配下には他の言語用の admin.json があります
全ての言語に対応してください

Copy link
Contributor Author

Copilot AI commented Jan 6, 2026

@copilot public/static/locales 配下には他の言語用の admin.json があります
全ての言語に対応してください

対応しました。全ての言語ファイル (en_US, ja_JP, fr_FR, ko_KR, zh_CN) にOAuth 2.0の翻訳を追加しました。

コミット: a6ad952

@yuki-takei
Copy link
Contributor

@copilot CI で lint error が出ているので修正して

eslint 管理対象のファイルなのか、biome でフォーマットされるべきファイルなのかを設定ファイルを確認して正しく把握してください

Copy link
Contributor Author

Copilot AI commented Jan 6, 2026

@copilot CI で lint error が出ているので修正して

eslint 管理対象のファイルなのか、biome でフォーマットされるべきファイルなのかを設定ファイルを確��...

修正しました。以下の対応を行いました:

  1. MailSetting.tsxから未使用のReactインポートを削除
  2. config-definition.tsmail.tsにbiomeフォーマットを適用

biome管理対象のファイル(src/client/components/Admin/App/**src/server/**)のみを修正しました。eslintの設定では、これらのファイルはignorePatternsに含まれているため、biomeでフォーマットされるべきファイルです。

コミット: a54af2e

@yuki-takei yuki-takei marked this pull request as ready for review January 8, 2026 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants