-
-
Notifications
You must be signed in to change notification settings - Fork 77
Changed retry logic for http calls in typescript code. #528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
1. Duplicate retires is not fired for the same failed request. 2. Calls to checkstatus is not retried if status failed is returned from the BankID API, since the retry will just result in another error in that case.
|
Were you able to reproduce this error? Is it possible to "mock" a network error somehow to test that behaviour? |
There was a problem hiding this 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 a race condition bug in the BankID authentication flow that causes duplicate retry attempts during checkStatus calls, particularly on iOS devices. The fix refactors the HTTP retry logic to prevent duplicate retries and adds control over whether HTTP errors should be retried.
Key Changes:
- Refactored TypeScript retry logic to consolidate retry handling and prevent duplicate retry attempts
- Added
retryOnHttpErrorparameter to control retry behavior on HTTP errors vs network errors - Disabled HTTP error retries for
checkStatusand QR code refresh endpoints where the BankID API doesn't allow retries
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/ActiveLogin.Authentication.BankId.AspNetCore/Client/activelogin-main.ts | Refactored postJson() function to fix duplicate retry bug and added selective retry control for different API endpoints |
| azure-pipelines.yml | Modified macOS build configuration (contains errors in the current changes) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@Abrissirba Yes, I deployed our sample project to Azure and added Application Insights logging to the TypeScript code. Then I tested the deployed web app on an iPhone using Chrome with a test BankID. The issue doesn’t occur every time, but once I got the frontend logging working, it wasn’t too hard to reproduce. |
This PR addresses issue #508 - Multiple collect attempts after collect already completed, causing the flow to fail
This PR fixes a bug in Active Login that can occur during auth, sign, or payment flows with BankID on the same device. The issue appears frequently on iOS devices when using browsers other than Safari (e.g., Edge or Chrome). It can also occur in Safari on iOS when using a custom browser configuration with a
returnUrlthat differs from the default used by Active Login.The bug is triggered when an error occurs during the call to the
checkStatusendpoint. On iOS, this may happen if the BankID security app is launched while the request is in progress. In that situation, the current TypeScript logic incorrectly triggers a duplicate retry. If the first retry completes successfully and the BankID order is finalized, the second retry will fail because the order no longer exists. This results in an HTTP 400 response from the BankID API and aBankIdApiExceptionwithInvalidParameters: No such order.This fix prevents duplicate retry calls and avoids retrying
checkStatusrequests when the HTTP status code indicates failure—since retries are not allowed by the BankIDcollectendpoint in such cases. Transient failures (e.g. temporary network errors) will still be retried as expected.This PR also updates our CI configuration to handle recent macOS runner changes:
macos-15-intelto ensure continued support for x86 builds on GitHub, since the defaultmacos-latestrunner is now ARM-based.These changes ensure our macOS builds run only on supported platforms and prevent intermittent architecture-related failures.