Skip to content

fix: mfa and add support for mfa qr code requirement#68

Merged
azerpas merged 7 commits intomainfrom
mfa-fix-and-qr-support
Jan 8, 2026
Merged

fix: mfa and add support for mfa qr code requirement#68
azerpas merged 7 commits intomainfrom
mfa-fix-and-qr-support

Conversation

@azerpas
Copy link
Owner

@azerpas azerpas commented Jan 8, 2026

Fixes #61

Helped by #67

  • Update MFA workflow to use /session/challenge/ endpoint for WebToApp (instead of /session/otp/)
  • Add missing Content-Type: application/json header to MFA request POST
  • Add QR code requirement support. Sometimes Bourso asks you for another QR code step.

This is a breaking change update since I'm unsure whether sms/email OTP will still be supported or if they deprecated it. For now we'll only support WebToApp. If sms/email OTP still works for some, I advise you to stay on 0.4.0.

Thanks a lot for the contribution @mquandalle

Co-authored-by: Maxime Quandalle <maxime.quandalle@gmail.com>
@azerpas azerpas requested a review from Copilot January 8, 2026 21:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes MFA authentication by migrating from the /session/otp/ endpoint to /session/challenge/ for WebToApp authentication. Key changes include adding QR code support for additional authentication steps that Boursobank may require, adding proper content-type headers to MFA requests, and replacing the interactive code entry workflow with an automated polling mechanism.

  • Migrated MFA from /session/otp/ to /session/challenge/ endpoint
  • Added QR code generation and display for additional authentication requirements
  • Replaced manual code entry with polling-based MFA validation

Reviewed changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/lib.rs Replaced interactive MFA code entry with automated polling loop that checks validation status every 5 seconds
src/bourso_api/src/client/qrcode.rs New module for generating and rendering QR codes in terminal with bank-specific settings
src/bourso_api/src/client/mod.rs Updated MFA workflow to use /session/challenge/ endpoint, added QR code support, and changed from submitting codes to checking status
src/bourso_api/Cargo.toml Added qrcode dependency for QR code generation
Cargo.toml Version bump from 0.4.0 to 0.5.0

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@codecov-commenter
Copy link

codecov-commenter commented Jan 8, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 27.11864% with 43 lines in your changes missing coverage. Please review.
✅ Project coverage is 43.33%. Comparing base (59e87a9) to head (e50e28b).

Files with missing lines Patch % Lines
src/bourso_api/src/client/mod.rs 27.11% 43 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #68      +/-   ##
==========================================
+ Coverage   33.55%   43.33%   +9.78%     
==========================================
  Files           9        9              
  Lines         304      240      -64     
==========================================
+ Hits          102      104       +2     
+ Misses        202      136      -66     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI and others added 2 commits January 8, 2026 22:55
* Initial plan

* Use lazy_static for OTP params regex to handle compilation errors at startup

Co-authored-by: azerpas <19282069+azerpas@users.noreply.github.com>

* Apply lazy_static pattern to all regex compilation in mod.rs

Co-authored-by: azerpas <19282069+azerpas@users.noreply.github.com>

* Replace unwrap() with proper error handling in extract_token and extract_user_contact

Co-authored-by: azerpas <19282069+azerpas@users.noreply.github.com>

* Remove all remaining unwrap() calls in extraction functions

Co-authored-by: azerpas <19282069+azerpas@users.noreply.github.com>

* Add documentation comments to lazy_static regex constants

Co-authored-by: azerpas <19282069+azerpas@users.noreply.github.com>

* Make error handling consistent across all extraction functions

Co-authored-by: azerpas <19282069+azerpas@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: azerpas <19282069+azerpas@users.noreply.github.com>
* Initial plan

* Extract duplicated JSON path in extract_otp_params

Co-authored-by: azerpas <19282069+azerpas@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: azerpas <19282069+azerpas@users.noreply.github.com>
Repository owner deleted a comment from Copilot AI Jan 8, 2026
Repository owner deleted a comment from Copilot AI Jan 8, 2026
@azerpas azerpas merged commit 6f599b5 into main Jan 8, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix MFA handling

4 participants