Oauth scopes management TTY workflows demand precision. Each scope defines a specific capability: reading user data, writing files, initiating transactions. In a terminal session, especially when using CLI-based tooling, these scopes are requested and granted at runtime. Scope overreach here is dangerous. A script granted full_access when only read_profile is needed creates unnecessary risk.
Start with least privilege. Map out every command and API call in your flow. Request only the scopes required. If your TTY workflow interacts with multiple APIs, segment scopes by function—auth per service, not one giant permission set.
Secure tokens rigorously. In the TTY, tokens can be echoed, logged, or cached unintentionally. Use environment variables and ephemeral storage. Revoke unused scopes immediately. Scope revocation should be part of your script’s teardown routine, not a future chore.