feat: add TOTP 2FA support to session token generation#44
Merged
Conversation
Co-authored-by: Villoh <93930400+Villoh@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the perplexity-webui-scraper token interactive CLI flow to support Perplexity accounts that require TOTP-based 2FA during session token generation, updating the auth flow to detect and complete the additional challenge step.
Changes:
- Refactors the
get_session_tokencommand into helper functions and adds TOTP challenge detection + verification loop. - Adds a new internal constant for the TOTP verification endpoint.
- Updates user-facing docs (README, CHANGELOG) and bumps a lockfile dependency.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
uv.lock |
Updates locked dependency version (joserfc). |
src/perplexity_webui_scraper/cli/commands/get_session_token.py |
Refactors OTP login flow and adds TOTP challenge handling during session token generation. |
src/perplexity_webui_scraper/_internal/constants.py |
Adds the TOTP challenge verify endpoint constant. |
README.md |
Documents that the token wizard supports TOTP 2FA. |
CHANGELOG.md |
Notes the new TOTP 2FA support in the token generation CLI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "emailLoginMethod": "web-otp", | ||
| }, | ||
| ) | ||
| otp_response.raise_for_status() |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
0bfe050 to
30567f6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements support for TOTP 2-Factor Authentication during the
get_session_tokenflow.It is heavily based on the initial work by @Villoh in #42, but was refactored to:
Co-authored-by: Villoh villoh.github@gmail.com
Closes #42