From 8bd2d71795c40f08fe949175fca8740cec3eef24 Mon Sep 17 00:00:00 2001 From: Paul Kartchner Date: Wed, 10 Dec 2025 03:53:52 +0000 Subject: [PATCH] Clean up OAuth configuration files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Removed get_gmail_refresh_token.py (no longer needed) - Removed emailproxy-config/ directory (already deleted) - Added Claude Code settings for easier development - Switched to Amazon SES for email delivery (configured in .env) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- .claude/settings.local.json | 10 ++++++ get_gmail_refresh_token.py | 71 ------------------------------------- 2 files changed, 10 insertions(+), 71 deletions(-) create mode 100644 .claude/settings.local.json delete mode 100755 get_gmail_refresh_token.py diff --git a/.claude/settings.local.json b/.claude/settings.local.json new file mode 100644 index 0000000..517fd20 --- /dev/null +++ b/.claude/settings.local.json @@ -0,0 +1,10 @@ +{ + "permissions": { + "allow": [ + "Bash(docker network:*)", + "Bash(openssl rand:*)" + ], + "deny": [], + "ask": [] + } +} diff --git a/get_gmail_refresh_token.py b/get_gmail_refresh_token.py deleted file mode 100755 index a8adda8..0000000 --- a/get_gmail_refresh_token.py +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/env python3 -""" -Gmail OAuth2 Refresh Token Generator for Vaultwarden -This script helps you generate a refresh token for Gmail SMTP OAuth2 authentication. -""" - -from google_auth_oauthlib.flow import InstalledAppFlow -import sys - -SCOPES = ['https://www.googleapis.com/auth/gmail.send'] - -def get_refresh_token(client_id, client_secret): - """Generate OAuth2 refresh token for Gmail""" - - client_config = { - "installed": { - "client_id": client_id, - "client_secret": client_secret, - "auth_uri": "https://accounts.google.com/o/oauth2/auth", - "token_uri": "https://oauth2.googleapis.com/token", - "redirect_uris": ["http://localhost:8080/"] - } - } - - print("=" * 70) - print("Gmail OAuth2 Refresh Token Generator") - print("=" * 70) - print() - print("IMPORTANT: Make sure you've added this redirect URI to your Google Cloud Console:") - print(" http://localhost:8080/") - print() - print("A browser window will open for you to authorize the application.") - print("Please sign in with your Google Workspace account and grant access.") - print() - - try: - flow = InstalledAppFlow.from_client_config(client_config, SCOPES) - creds = flow.run_local_server(port=8080) - - print() - print("=" * 70) - print("SUCCESS! OAuth2 credentials obtained") - print("=" * 70) - print() - print("Add these to your Vaultwarden .env file:") - print() - print(f"SMTP_AUTH_MECHANISM=Xoauth2") - print(f"SMTP_OAUTH2_CLIENT_ID={client_id}") - print(f"SMTP_OAUTH2_CLIENT_SECRET={client_secret}") - print(f"SMTP_OAUTH2_REFRESH_TOKEN={creds.refresh_token}") - print() - print("=" * 70) - - except Exception as e: - print(f"Error: {e}", file=sys.stderr) - sys.exit(1) - -if __name__ == "__main__": - print() - print("Please enter your Google Cloud OAuth2 credentials:") - print("(You can get these from https://console.cloud.google.com)") - print() - - client_id = input("Enter your OAuth2 Client ID: ").strip() - client_secret = input("Enter your OAuth2 Client Secret: ").strip() - - if not client_id or not client_secret: - print("Error: Both Client ID and Client Secret are required!", file=sys.stderr) - sys.exit(1) - - get_refresh_token(client_id, client_secret)