You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gog --client work auth credentials ~/Downloads/work-client.json
95
+
gog auth credentials list
96
+
```
97
+
91
98
### 3. Authorize Your Account
92
99
93
100
```bash
@@ -109,7 +116,7 @@ gog gmail labels list
109
116
110
117
`gog` stores your OAuth refresh tokens in a “keyring” backend. Default is `auto` (best available backend for your OS/environment).
111
118
112
-
Before you can run `gog auth add`, you must store OAuth client credentials once via `gog auth credentials <credentials.json>` (download a Desktop app OAuth client JSON from the Cloud Console).
119
+
Before you can run `gog auth add`, you must store OAuth client credentials once via `gog auth credentials <credentials.json>` (download a Desktop app OAuth client JSON from the Cloud Console). For multiple clients, use `gog --client <name> auth credentials ...`; tokens are isolated per client.
113
120
114
121
List accounts:
115
122
@@ -131,6 +138,52 @@ Show current auth state/services for the active account:
131
138
gog auth status
132
139
```
133
140
141
+
### Multiple OAuth clients
142
+
143
+
Use `--client` (or `GOG_CLIENT`) to select a named OAuth client:
144
+
145
+
```bash
146
+
gog --client work auth credentials ~/Downloads/work.json
147
+
gog --client work auth add you@company.com
148
+
```
149
+
150
+
Optional domain mapping for auto-selection:
151
+
152
+
```bash
153
+
gog --client work auth credentials ~/Downloads/work.json --domain example.com
154
+
```
155
+
156
+
How it works:
157
+
158
+
- Default client is `default` (stored in `credentials.json`).
159
+
- Named clients are stored as `credentials-<client>.json`.
160
+
- Tokens are isolated per client (`token:<client>:<email>`); defaults are per client too.
161
+
162
+
Client selection order (when `--client` is not set):
163
+
164
+
1)`--client` / `GOG_CLIENT`
165
+
2)`account_clients` config (email -> client)
166
+
3)`client_domains` config (domain -> client)
167
+
4) Credentials file named after the email domain (`credentials-example.com.json`)
168
+
5)`default`
169
+
170
+
Config example (JSON5):
171
+
172
+
```json5
173
+
{
174
+
account_clients: { "you@company.com":"work" },
175
+
client_domains: { "example.com":"work" },
176
+
}
177
+
```
178
+
179
+
List stored credentials:
180
+
181
+
```bash
182
+
gog auth credentials list
183
+
```
184
+
185
+
See `docs/auth-clients.md` for the full client selection and mapping rules.
186
+
134
187
### Keyring backend: Keychain vs encrypted file
135
188
136
189
Backends:
@@ -317,6 +370,7 @@ gog keep get <noteId> --account you@yourdomain.com
317
370
### Environment Variables
318
371
319
372
-`GOG_ACCOUNT` - Default account email or alias to use (avoids repeating `--account`; otherwise uses keyring default or a single stored token)
@@ -122,13 +127,15 @@ We intentionally avoid storing refresh tokens in plain JSON on disk.
122
127
Environment:
123
128
124
129
-`GOG_ACCOUNT=you@gmail.com` (email or alias; used when `--account` is not set; otherwise uses keyring default or a single stored token)
130
+
-`GOG_CLIENT=work` (select OAuth client bucket; see `--client`)
125
131
-`GOG_KEYRING_PASSWORD=...` (used when keyring falls back to encrypted file backend in non-interactive environments)
126
132
-`GOG_KEYRING_BACKEND={auto|keychain|file}` (force backend; use `file` to avoid Keychain prompts and pair with `GOG_KEYRING_PASSWORD` for non-interactive)
127
133
-`GOG_TIMEZONE=America/New_York` (default output timezone; IANA name or `UTC`; `local` forces local timezone)
128
134
-`GOG_ENABLE_COMMANDS=calendar,tasks` (optional allowlist of top-level commands)
129
135
-`config.json` can also set `keyring_backend` (JSON5; env vars take precedence)
130
136
-`config.json` can also set `default_timezone` (IANA name or `UTC`)
131
137
-`config.json` can also set `account_aliases` for `gog auth alias` (JSON5)
138
+
-`config.json` can also set `account_clients` (email -> client) and `client_domains` (domain -> client)
0 commit comments