create-neomutt-gmail 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +91 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -113,39 +113,82 @@ The wizard will:
|
|
|
113
113
|
|
|
114
114
|
## After Installation
|
|
115
115
|
|
|
116
|
+
### Understanding the Authentication Flow
|
|
117
|
+
|
|
118
|
+
This setup uses **two different security mechanisms**:
|
|
119
|
+
|
|
120
|
+
| Component | Purpose | Where to get it |
|
|
121
|
+
|-----------|---------|----------------|
|
|
122
|
+
| **GPG Key** | Encrypts OAuth token on your disk | Create with `gpg --full-generate-key` |
|
|
123
|
+
| **OAuth2 Credentials** | Authenticates with Gmail | Google Cloud Console |
|
|
124
|
+
|
|
125
|
+
**Common mistake**: These are NOT the same thing. You need both.
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
116
129
|
### Step 1: Google Cloud Console
|
|
117
130
|
|
|
118
131
|
1. Visit https://console.cloud.google.com/
|
|
119
|
-
2. Create a new project
|
|
120
|
-
3. Enable Gmail API
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
132
|
+
2. Create a new project (e.g., "neomutt-gmail")
|
|
133
|
+
3. Enable Gmail API:
|
|
134
|
+
- Go to "APIs & Services" → "Enable APIs and Services"
|
|
135
|
+
- Search for "Gmail API" and enable it
|
|
136
|
+
4. Configure OAuth consent screen:
|
|
137
|
+
- User Type: **External** (for personal Gmail)
|
|
138
|
+
- App name: Any name (e.g., "Mutt Email Client")
|
|
139
|
+
- Add scope: `https://mail.google.com/`
|
|
140
|
+
- Add your email as test user
|
|
141
|
+
5. Create OAuth client ID:
|
|
142
|
+
- Go to "Credentials" → "Create Credentials" → "OAuth client ID"
|
|
143
|
+
- Application type: **Desktop app**
|
|
144
|
+
- Name: Any name (e.g., "Mutt")
|
|
145
|
+
6. **Save these credentials** (you'll need them in Step 2):
|
|
146
|
+
- Client ID (looks like: `123456789-abc.apps.googleusercontent.com`)
|
|
147
|
+
- Client Secret (looks like: `GOCSPX-abc123xyz`)
|
|
148
|
+
|
|
149
|
+
---
|
|
126
150
|
|
|
127
151
|
### Step 2: Obtain OAuth Token
|
|
128
152
|
|
|
129
|
-
Run
|
|
153
|
+
Run this command (the wizard shows you the exact command):
|
|
130
154
|
|
|
131
155
|
```bash
|
|
132
156
|
python3 ~/.config/mutt/mutt_oauth2.py \
|
|
133
157
|
--authorize \
|
|
134
158
|
--authflow localhostauthcode \
|
|
135
|
-
--encryption-pipe 'gpg --encrypt --recipient
|
|
159
|
+
--encryption-pipe 'gpg --encrypt --recipient YOUR_EMAIL@gmail.com' \
|
|
136
160
|
--client-id YOUR_CLIENT_ID.apps.googleusercontent.com \
|
|
137
161
|
--client-secret YOUR_CLIENT_SECRET \
|
|
138
162
|
--provider google \
|
|
139
|
-
--email
|
|
163
|
+
--email YOUR_EMAIL@gmail.com \
|
|
140
164
|
~/.local/etc/oauth-tokens/gmail.tokens
|
|
141
165
|
```
|
|
142
166
|
|
|
167
|
+
**What each parameter means**:
|
|
168
|
+
|
|
169
|
+
| Parameter | Example | Where from |
|
|
170
|
+
|-----------|---------|-----------|
|
|
171
|
+
| `--recipient` | `your@gmail.com` | Your GPG key (created with `gpg --full-generate-key`) |
|
|
172
|
+
| `--client-id` | `123...apps.googleusercontent.com` | Google Cloud Console (Step 1) |
|
|
173
|
+
| `--client-secret` | `GOCSPX-...` | Google Cloud Console (Step 1) |
|
|
174
|
+
| `--email` | `your@gmail.com` | Your Gmail address |
|
|
175
|
+
|
|
176
|
+
**What happens**:
|
|
177
|
+
1. Browser opens for Google authentication
|
|
178
|
+
2. You authorize the app
|
|
179
|
+
3. Token is downloaded and encrypted with your GPG key
|
|
180
|
+
4. You'll be prompted for your GPG passphrase
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
143
184
|
### Step 3: Launch Neomutt
|
|
144
185
|
|
|
145
186
|
```bash
|
|
146
187
|
neomutt
|
|
147
188
|
```
|
|
148
189
|
|
|
190
|
+
You'll be prompted for your GPG passphrase when Neomutt reads the encrypted token.
|
|
191
|
+
|
|
149
192
|
## Keyboard Shortcuts
|
|
150
193
|
|
|
151
194
|
Once Neomutt is running:
|
|
@@ -206,6 +249,8 @@ Create a GPG key:
|
|
|
206
249
|
gpg --full-generate-key
|
|
207
250
|
```
|
|
208
251
|
|
|
252
|
+
Remember: This GPG key is for **encrypting the OAuth token on your disk**, not for Google authentication.
|
|
253
|
+
|
|
209
254
|
### "Failed to download mutt_oauth2.py"
|
|
210
255
|
|
|
211
256
|
Download manually:
|
|
@@ -217,7 +262,42 @@ chmod +x ~/.config/mutt/mutt_oauth2.py
|
|
|
217
262
|
|
|
218
263
|
### OAuth Token Issues
|
|
219
264
|
|
|
220
|
-
|
|
265
|
+
**"Invalid credentials"**: Check that your Client ID and Secret are correct.
|
|
266
|
+
|
|
267
|
+
**"Error decrypting token"**: Your GPG key might not be set up correctly. Run:
|
|
268
|
+
```bash
|
|
269
|
+
gpg --list-secret-keys
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
See the [detailed troubleshooting guide](https://github.com/a-lost-social-misfit/terminal-blog) for more help.
|
|
273
|
+
|
|
274
|
+
## Common Misconceptions
|
|
275
|
+
|
|
276
|
+
### GPG vs OAuth2
|
|
277
|
+
|
|
278
|
+
**These are two completely different things:**
|
|
279
|
+
|
|
280
|
+
- **GPG**: Local encryption tool
|
|
281
|
+
- Purpose: Encrypt the OAuth token file on your disk
|
|
282
|
+
- Where: Your computer (`gpg --full-generate-key`)
|
|
283
|
+
- When: Once, during initial setup
|
|
284
|
+
|
|
285
|
+
- **OAuth2**: Google's authentication protocol
|
|
286
|
+
- Purpose: Prove your identity to Gmail
|
|
287
|
+
- Where: Google Cloud Console
|
|
288
|
+
- When: You need Client ID and Secret from Google
|
|
289
|
+
|
|
290
|
+
**You need BOTH**:
|
|
291
|
+
1. Create a GPG key (once)
|
|
292
|
+
2. Get OAuth credentials from Google (once)
|
|
293
|
+
3. Run `mutt_oauth2.py` (uses both to create encrypted token)
|
|
294
|
+
|
|
295
|
+
### Why use GPG encryption?
|
|
296
|
+
|
|
297
|
+
The OAuth token allows full access to your Gmail. GPG encryption ensures:
|
|
298
|
+
- Token is encrypted on disk
|
|
299
|
+
- Only you (with GPG passphrase) can decrypt it
|
|
300
|
+
- Safer than storing plain text
|
|
221
301
|
|
|
222
302
|
## Powered By
|
|
223
303
|
|