SmugMug uses OAuth 1.0a, which requires 4 pieces of information total:
┌─────────────────────────────────────────────────────────────┐
│ SmugMug Authentication │
├─────────────────────────────────────────────────────────────┤
│ │
│ 1. Application Credentials (from SmugMug Developer Portal) │
│ ├── api_key (identifies YOUR app) │
│ └── api_secret (proves it's YOUR app) │
│ │
│ 2. User Access Tokens (from OAuth authorization flow) │
│ ├── user_token (which SmugMug user) │
│ └── user_secret (proves user authorized you) │
│ │
└─────────────────────────────────────────────────────────────┘
Think of it like a building with security:
- API Key/Secret: Your company ID badge (identifies smugVision app)
- User Token/Secret: Visitor pass for a specific person (your SmugMug account)
Both are required to access the building (SmugMug API).
1. Go to: https://api.smugmug.com/api/developer/apply
2. Fill out form:
┌──────────────────────────────────────┐
│ Application Name: smugVision │
│ Description: AI photo metadata │
│ Platform: Desktop Application │
└──────────────────────────────────────┘
3. Submit and wait for approval email
4. You receive:
✅ API Key (e.g., "abc123...")
✅ API Secret (e.g., "xyz789...")
Option A: Use our script (easiest)
─────────────────────────────────────
1. Run: python get_smugmug_tokens.py
2. Enter your API Key and Secret from Part 1
3. Browser opens to SmugMug authorization page:
┌─────────────────────────────────────────┐
│ smugVision wants to access your │
│ SmugMug account │
│ │
│ This will allow smugVision to: │
│ • View your photos │
│ • Modify photo metadata │
│ │
│ [ Cancel ] [ Authorize ] │
└─────────────────────────────────────────┘
4. Click "Authorize"
5. You get a 6-digit code: 123456
6. Enter code in terminal
7. Script displays:
✅ user_token (e.g., "def456...")
✅ user_secret (e.g., "ghi789...")
Option B: Manual OAuth (advanced)
──────────────────────────────────
If you're comfortable with OAuth flows, you can:
1. Request a request token
2. Authorize at: https://api.smugmug.com/services/oauth/1.0a/authorize
3. Exchange verification code for access tokens
The script does this automatically for you.
1. Edit: ~/.smugvision/config.yaml
2. Add all 4 credentials:
smugmug:
api_key: "abc123..." # From Part 1
api_secret: "xyz789..." # From Part 1
user_token: "def456..." # From Part 2
user_secret: "ghi789..." # From Part 2
3. Save file
4. Test: python test_smugmug.py <album_key>
A: The API key says "this is smugVision app" but doesn't say which SmugMug user. The user tokens say "John Doe has authorized smugVision to access his photos."
A:
- API Key/Secret: No expiration (unless you revoke them)
- User Token/Secret: No expiration (unless you revoke or change password)
You only need to get them once!
A: Yes, but:
- ✅ Store in
~/.smugvision/config.yaml(not in code) - ✅ Add
config.yamlto.gitignore - ✅ Don't share them publicly
- ✅ Use file permissions:
chmod 600 ~/.smugvision/config.yaml
A: Yes! Copy your config.yaml to each computer. The tokens work anywhere.
A: Check:
- All 4 credentials are in config.yaml
- No extra spaces or quotes
- API key is approved (check email)
- User tokens were obtained for the correct API key
- Run
get_smugmug_tokens.pyagain if needed
A: The tokens have:
- ✅ Read access (view albums and images)
- ✅ Write access (update captions and keywords)
- ✅ Full access to your account
This is required for smugVision to work. You can revoke access anytime from SmugMug settings.
✅ DO:
- Store credentials in ~/.smugvision/config.yaml
- Set file permissions: chmod 600 ~/.smugvision/config.yaml
- Add config.yaml to .gitignore
- Revoke tokens if compromised
❌ DON'T:
- Commit credentials to git
- Share tokens publicly
- Use tokens from untrusted sources
- Store in public repositories
→ Wait for approval email from SmugMug → Check spam folder
→ Check all 4 credentials are correct → No extra spaces in config.yaml → User tokens match the API key used
→ Script shows URL, copy to browser manually → Or use manual OAuth flow
→ Make sure it's the 6-digit code from SmugMug → Try getting a new code (run script again) → Check you authorized the correct app
# 1. Get API key
Visit: https://api.smugmug.com/api/developer/apply
# 2. Get user tokens
python get_smugmug_tokens.py
# 3. Test authentication
python test_smugmug.py <album_key>- Check SmugMug API docs: https://api.smugmug.com/api/v2/doc
- Review OAuth 1.0a spec: https://oauth.net/core/1.0a/
- Check smugVision logs: ~/.smugvision/smugvision.log