Search products, add to cart, and find store locations via the Kroger public API.
Set these before using:
export KROGER_CLIENT_ID="your-client-id"
export KROGER_CLIENT_SECRET="your-client-secret"
Optional:
KROGER_TOKEN_FILE — token storage path (default: ~/.kroger-tokens.json)KROGER_REDIRECT_URI — OAuth callback URL (default: http://localhost:8888/callback)KROGER_LOCATION_ID — store ID for location-specific product availabilityhttp://localhost:8888/callbackRun the auth flow — opens a browser for Kroger login:
scripts/kroger.sh auth
If the redirect URI isn't localhost (e.g., cloud-hosted), use the manual flow:
AUTH_URL printed by scripts/kroger.sh authcode parameter and run:scripts/kroger.sh exchange <code>
Tokens auto-refresh. Re-auth only needed if refresh token expires.
scripts/kroger.sh search "cannellini beans"
Returns up to 5 results with product IDs, descriptions, and brands.
scripts/kroger.sh add <productId> [quantity]
Requires prior OAuth login. Quantity defaults to 1.
scripts/kroger.sh locations <zipcode>
Returns up to 5 stores with location IDs. Set KROGER_LOCATION_ID to filter product search by store.
scripts/kroger.sh token
Typical flow for adding a grocery list to Kroger:
scripts/kroger.sh search "- "
scripts/kroger.sh add When adding many items, batch all searches first, then confirm selections with the user, then add all to cart.
共 1 个版本