iOS web app looses connection when switching to bank-id

1.4k Views Asked by At

I have created a web app with a button to log in using bank id. Clicking the button the browser will post a request to the backend (using javascript fetch) for a bank-id login. The backend in its turn, will post to bank-id to initiate a bank-id login. If using their mobiles, users will now switch from the browser to the bank-id app and do their authentication. When the user has signed in, bank-id will return a success result to the backend and it will complete the call and return the result to the browser.

This works perfectly on android, but on mobile iOS the browser (safari atleast) seems to clean up the connection that javascript fetch made to the backend most of the time when the user switches to the bank-id app and the browser is no longer in focus. Sometimes it works and the connection is kept open, but most of the times not.

Does anyone have a solution to this? Is it possible to make the iOS browser keep the connection open when switching apps. Or does anyone have a suggestion for a different design?

(Bankid is a solution for digital signatures that is used extensively to authenticate in Sweden)

1

There are 1 best solutions below

8
On BEST ANSWER

Create a custom url scheme for your app. When starting the BankID application, use the redirect parameter to let the BankID application call back to your app.

https://app.bankid.com/?autostarttoken=[TOKEN]&redirect=[RETURNURL]