Skip to content

feat: add TOTP 2FA support to session token generation#42

Closed
Villoh wants to merge 3 commits into
henrique-coder:prodfrom
Villoh:feature/add-support-2fa
Closed

feat: add TOTP 2FA support to session token generation#42
Villoh wants to merge 3 commits into
henrique-coder:prodfrom
Villoh:feature/add-support-2fa

Conversation

@Villoh
Copy link
Copy Markdown
Contributor

@Villoh Villoh commented May 22, 2026

Summary

Adds support for Perplexity accounts with TOTP-based two-factor authentication in the interactive session token generator.

Changes

  • Detects TOTP challenge redirect after email OTP callback
  • Prompts user for authenticator app code (6-digit TOTP)
  • POSTs to /api/auth/totp/challenge-verify with challenge token
  • Updates README and CHANGELOG

Villoh added 2 commits May 22, 2026 21:28
- Detect TOTP challenge redirect after email OTP callback
- Prompt user for authenticator app code (6-digit TOTP)
- POST to /api/auth/totp/challenge-verify with challenge token
- Extract _prompt_email, _fetch_csrf, _send_otp, _resolve_redirect_url
- Extract _follow_callback, _verify_totp, _extract_and_present_token
- run() now acts as a thin orchestrator (~25 lines)
- Fixes CodeFactor 'Complex Method' flag
@henrique-coder
Copy link
Copy Markdown
Owner

henrique-coder commented May 23, 2026

Hey @Villoh, thank you so much for this contribution! Your PR was a fantastic starting point for the TOTP implementation.

Since there were some merge conflicts with recent updates to the CLI flow (PR #41), and we needed to add some extra error-handling logic (like retry loops for invalid/expired OTP and TOTP codes to prevent API crashes), I ended up refactoring the implementation in a new branch.

I've opened PR #44 to merge these changes. I made sure to include you as a Co-authored-by in the commit so you will receive full contribution credits on GitHub for the original idea and logic!

I'll be closing this PR in favor of #44. Thanks again for your awesome work!

@Villoh Villoh deleted the feature/add-support-2fa branch May 29, 2026 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants