Localstorage for our webapp (react) behaves strange when the site is opened in the Facebook browser on iOS and android. We have an authentication flow that depends on storing a token in localstorage and reading it. The symptoms we see when our site is opened in the facebook browser (a user clicks on a link to our site on Facebook) is that the auth flow fails on the first attempt at login but works on the second attempt at login. It appears like the localstorage is asyncronous. At least it behaves differently from other browsers like Chrome, Firefox and Safari.
I have tried to do a setTimeout of up to 700 ms before redirecting after login, but it still fails to read the token from localstorage.
I am however able to do localstorage.getItem(key) immediately after localstorage.setItem(key, value) and get the expected result.