Authentication
Sign in with TOTP or BankID and manage the saved session.
Getting a TOTP secret
- Sign in to Avanza and go to Profil → Inställningar → Sajtinställningar → Inloggning och utloggning → Användarnamn → Tvåfaktorsinloggning.
- Choose Aktivera to set up two-factor login. If it is already enabled, choose Återaktivera instead.
- Select Annan app för tvåfaktorsinloggning.
- Select Kan du inte scanna QR-koden? to reveal the TOTP secret. Add that secret to your authenticator app.
- Enter the six-digit code from the authenticator app on Avanza to complete setup.
Reactivation may invalidate a previous authenticator setup. Do not share or commit the secret.
TOTP login
avanza auth totpThe CLI prompts for missing credentials and masks passwords and TOTP codes. For non-interactive use, set AVANZA_USERNAME and AVANZA_PASSWORD, plus exactly one of AVANZA_TOTP_CODE or AVANZA_TOTP_SECRET. Credentials used to authenticate are not stored; only the resulting session is saved.
BankID
avanza auth bankidBankID requires an interactive terminal. The CLI displays and refreshes a QR code until the attempt finishes or is cancelled.
Check or clear the session with avanza auth session and avanza auth logout. See session storage for details.