fix: mfa and add support for mfa qr code requirement#68
Conversation
Co-authored-by: Maxime Quandalle <maxime.quandalle@gmail.com>
There was a problem hiding this comment.
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 Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
* 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>
Fixes #61
Helped by #67
/session/challenge/endpoint for WebToApp (instead of/session/otp/)Content-Type: application/jsonheader to MFA request POSTThis 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