TOTP Login Process
Time-based One-Time Password (TOTP) adds an extra layer of security to your Pocketful account. Once enabled, you will be required to provide a 6-digit verification code from an authenticator app in addition to your login credentials.
1. Enable TOTP
To enable TOTP for your account, follow these steps:
- Log in to the Pocketful API Portal.
- Look for the Enable TOTP or 2FA via Authenticator option and click on it.
- A QR code will be displayed on the screen.
- Open your preferred authenticator app (e.g., Google Authenticator, Authy, or Microsoft Authenticator) and scan the QR code.
- Enter the 6-digit code generated by the app into the verification box on the portal to confirm the setup.
!!! tip "Save the Secret Key"
During the setup process, a TOTP Secret Key will be displayed. It is highly recommended to save this key securely. This secret key can be used to generate TOTP codes programmatically (e.g., using the pyotp library in Python) for automated algo-trading scripts.
2. Logging In with TOTP
Once TOTP is enabled, the login flow changes as follows:
- Step 1: Credentials: Enter your Email/Client ID and Password on the Login Page.
- Step 2: TOTP Verification: After submitting your credentials, you will be redirected to a verification screen.
- Step 3: Enter Code: Open your authenticator app, find the Pocketful entry, and enter the current 6-digit code.
- Step 4: Access Granted: Upon successful verification, you will gain access to the dashboard.
3. Automated TOTP Generation (Python Example)
For developers building automated trading systems, you can generate the TOTP code programmatically using the pyotp library. This eliminates the need for manual entry during the authentication process.
import pyotp
# Your TOTP Secret Key saved during setup
totp_secret = "YOUR_KNOWLEDGE_BASE_SECRET_KEY"
# Generate the current 6-digit TOTP code
totp = pyotp.TOTP(totp_secret)
current_code = totp.now()
print(f"Current TOTP Code: {current_code}")
To use this, install the library via pip:
pip install pyotp