Skip to content

Commit f1b8e12

Browse files
wesmclaude
andcommitted
Show helpful OAuth setup instructions when client_secrets is missing
Fixes #1. Replace the cryptic "oauth.client_secrets not configured in config.toml" error with step-by-step setup instructions and a link to the guide. Also make the OAuth prerequisite more prominent in the README Quick Start section. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 048f163 commit f1b8e12

File tree

7 files changed

+20
-8
lines changed

7 files changed

+20
-8
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@ make install
4646

4747
## Quick Start
4848

49+
> **Prerequisites:** You need a Google Cloud OAuth credential before adding an account.
50+
> Follow the **[OAuth Setup Guide](https://msgvault.io/guides/oauth-setup/)** to create one (~5 minutes).
51+
4952
```bash
5053
msgvault init-db
5154
msgvault add-account you@gmail.com # opens browser for OAuth
5255
msgvault sync-full you@gmail.com --limit 100
5356
msgvault tui
5457
```
5558

56-
OAuth requires a Google Cloud project with the Gmail API enabled.
57-
See the **[Setup Guide](https://msgvault.io/guides/oauth-setup/)** for step-by-step instructions.
58-
5959
## Commands
6060

6161
| Command | Description |

cmd/msgvault/cmd/addaccount.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Example:
2929

3030
// Validate config
3131
if cfg.OAuth.ClientSecrets == "" {
32-
return fmt.Errorf("oauth.client_secrets not configured in config.toml")
32+
return errOAuthNotConfigured()
3333
}
3434

3535
// Initialize database (in case it's new)

cmd/msgvault/cmd/deletions.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ Examples:
212212

213213
// Validate config
214214
if cfg.OAuth.ClientSecrets == "" {
215-
return fmt.Errorf("oauth.client_secrets not configured in config.toml")
215+
return errOAuthNotConfigured()
216216
}
217217

218218
// Collect unique accounts from manifests

cmd/msgvault/cmd/root.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,18 @@ func Execute() error {
5454
return rootCmd.Execute()
5555
}
5656

57+
// errOAuthNotConfigured returns a helpful error when OAuth client secrets are missing.
58+
func errOAuthNotConfigured() error {
59+
return fmt.Errorf(`OAuth client secrets not configured.
60+
61+
To use msgvault, you need a Google Cloud OAuth credential:
62+
1. Follow the setup guide: https://msgvault.io/guides/oauth-setup/
63+
2. Download the client_secret.json file
64+
3. Add to your config.toml:
65+
[oauth]
66+
client_secrets = "/path/to/client_secret.json"`)
67+
}
68+
5769
func init() {
5870
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default: ~/.msgvault/config.toml)")
5971
rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "verbose output")

cmd/msgvault/cmd/sync.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Examples:
3535

3636
// Validate config
3737
if cfg.OAuth.ClientSecrets == "" {
38-
return fmt.Errorf("oauth.client_secrets not configured in config.toml")
38+
return errOAuthNotConfigured()
3939
}
4040

4141
// Open database

cmd/msgvault/cmd/syncfull.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Examples:
4646

4747
// Validate config
4848
if cfg.OAuth.ClientSecrets == "" {
49-
return fmt.Errorf("oauth.client_secrets not configured in config.toml")
49+
return errOAuthNotConfigured()
5050
}
5151

5252
// Open database

cmd/msgvault/cmd/verify.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Examples:
3737

3838
// Validate config
3939
if cfg.OAuth.ClientSecrets == "" {
40-
return fmt.Errorf("oauth.client_secrets not configured in config.toml")
40+
return errOAuthNotConfigured()
4141
}
4242

4343
// Open database

0 commit comments

Comments
 (0)