Reload PWA (offline profile) at invalid session

0
Hi, I've recenlty built a PWA with Mx 9.4. The app has a SAML implementation which works as expected, the same as in a responsive app.  The app can be installed to home screen, which creates a shell around the web app using the settings from the manifest json. I used the standalone setting to create a more app like feeling. When the app is opened the first time, it lands on the SSO page, but when the app is already running in the background and reopened from the app overview on the device, it's not reloading: it still can be used offline (from cache so it seems) . This is expected, but when i start any online action like Synchronization a couple of hours after login (probably at an expired sso session), the app throws an error and I see the following in the server log: 2021-08-26T19:08:47.183289 [APP/PROC/WEB/0]   ERROR - Connector: An error has occurred while handling the request. 2021-08-26T19:08:47.183311 [APP/PROC/WEB/0]   ERROR - Connector: java.util.NoSuchElementException: None.get 2021-08-26T19:08:47.183464 [APP/PROC/WEB/0]       at scala.None$.get(Option.scala:627) The app is online but still no sync available, the probable cause is a sso session that became invalid.  When i then close the app and restart it from the app page, i see the splash screen and the app is being reloaded, giving me the SSO landing page. Does anyone has an idea how to solve this in a web PWA? I need a function when opening the app from background to foregorund to check for a valid SSO token, and when invalid, f.i. reloading the index page. I know this can be done in Native by using an app event.  Does anyone know how to do this in an offline pwa page? I read about caching strategies to apply in the service-worker, using tags in HTML pages, reloading windows in JS or using the start_url setting in manifest.json. But what is the best approach for a mendix PWA? 
asked
2 answers
3

Fixed it by setting ‘start_url’ in the manifest-overrides.webmanifest file:

{
  "background_color": "#FFFFFF",
  "display": "standalone",
  "theme_color": "#222B53",
  "start_url" : "./index.html"
}

This will trigger the app to redirect to /SSO/ handler each time the app is resumed from the background or at initial start. With this solution, the LongLivedSessionTimeout is also applied so it seems :)

answered
0

Sounds like something that Mendix is the best party to help you out. Certainly if this is reproducable. So, besides hoping someone here might help you out, also open a ticket at support.mendix.com

answered