Authentication
Learn how to authenticate and manage sessions with Paystack CLI.
Login
The CLI uses your Paystack account credentials for authentication:
paystack-cli loginLogin Process
When you run the login command, you'll be prompted for:
- Email Address - Your Paystack account email
- Password - Your Paystack account password
- Remember Email - Option to save your email for faster future logins
$ paystack-cli login
Email address: john@example.com
Password: ********
Remember Email Address? (yes/no): yesIntegration Selection
If your account has multiple integrations (businesses), you'll be prompted to select which one to use:
Select an integration:
1. My Business (test)
2. Another Business (live)The selected integration will be used for all subsequent API calls.
Session Management
Automatic Session Handling
Once logged in, the CLI automatically manages your session:
- Session tokens are securely stored in a local SQLite database
- Tokens are automatically included in all API requests
- You don't need to manually handle authentication for each command
Session Expiration
Sessions automatically expire after the token timeout period. When your session expires:
ERROR: Your session has expired. Please run the `login` command to sign in again.Simply run paystack-cli login again to re-authenticate.
Checking Session Status
Your session is automatically validated before each API call. If you're not logged in, you'll see:
ERROR: You're not signed in, please run the login command before you beginLogout
To clear your session and logout:
paystack-cli logoutThis will:
- Remove your authentication token
- Clear the selected integration
- Require you to login again before making API calls
Security
Local Storage
The CLI stores authentication data locally in a SQLite database located at:
<project-root>/app.dbThis file contains:
- Your authentication token
- User information
- Selected integration details
- Configuration settings
WARNING
Keep your app.db file secure and never commit it to version control.
Best Practices
- Use Test Mode - Start with test mode integrations for development
- Logout When Done - Run
logouton shared machines - Secure Your Database - Keep
app.dbfile permissions restricted - Don't Share Tokens - Never share your authentication token or database file
Switching Integrations
To switch between integrations:
Logout from the current session:
bashpaystack-cli logoutLogin again and select a different integration:
bashpaystack-cli login
Troubleshooting
"You're not signed in" Error
Solution: Run the login command first
paystack-cli login"Session expired" Error
Solution: Your session has timed out, login again
paystack-cli logout
paystack-cli loginCan't Login
Possible causes:
- Incorrect email or password
- Network connectivity issues
- Paystack API is down
Solution: Verify your credentials and try again
Next Steps
- Learn about Configuration options
- Explore available Commands
- Start using the API