About Lesson
Lesson Notes
-
Importance of Securing API Keys:
- API keys and tokens are the keys to accessing Mpesa’s services, making them highly sensitive. Exposure can lead to unauthorized access and misuse of the system.
-
Storing API Keys Securely:
- Never hardcode keys directly into your codebase.
- Store keys and tokens in environment variables or secure vault services (e.g., AWS Secrets Manager, HashiCorp Vault).
- Use
.env
files in local environments and ensure they are added to.gitignore
to avoid version control leakage.
-
Token Management:
- Use short-lived tokens and refresh them regularly.
- Revoke unused or compromised tokens immediately.
- Ensure tokens are sent securely over HTTPS to prevent interception.
-
Access Control:
- Implement proper role-based access control (RBAC) for managing access to keys and tokens within your team.
- Limit the number of people who have access to sensitive production keys.