8
Views
3
Comments
Solved
[IdPReact] Persist authentication offline
Forge component by Telmo Martins
2
Published on 02 Mar 2021
Application Type
Mobile

Hi All,


So I’m looking to create a PWA with offline capabilities and use Azure AD as authentication mechanism.

My app works fine if I’m online but when I’m offline he always tries to authenticate.

So is there a way to persist my authentication so that I can login once and then work offline for a few days?


Kind regards

Ibbe

Rank: #5849
Solution

Hi Chris,

Thanks for your insights.

I stared this thread to see of someone else had a solution, so since I found a solution I will share it here as well. 

After creating this post I continued my search for a solution.

If a native  iOS application using IDP Mobile is able to persist the logged in user than technically IDP React should be able to do the same, so I found this post: Persistent Login - OutSystems, note the RememberLogin option.

I started looking in to the IDP, IDP Mobile and IDP React modules and found that the IDP server action UserLogin_React calls the System.Login action with the Persistent value set to false. I changed the Persistent value to True.

Republished the IDP, and IDP React modules as well as my Test application.

And behold, my PWA only logs in once and if I disable my internet connection, than the app keeps working and doesn’t try to redirect me to the Azure authentication pages.


So as a proof of concept it is working but I don’t know how I feel about changing the IDP module source in relation to future updates of the module.  

Hi Ibbe,

Good evening!

I think it's not possible. My perspective is you have to do a light weight entity to the local storage that will mimic your authentication for offline. Then when it's online do a synch.

Hope this helps,

Kind regards.

Chris

Rank: #5849
Solution

Hi Chris,

Thanks for your insights.

I stared this thread to see of someone else had a solution, so since I found a solution I will share it here as well. 

After creating this post I continued my search for a solution.

If a native  iOS application using IDP Mobile is able to persist the logged in user than technically IDP React should be able to do the same, so I found this post: Persistent Login - OutSystems, note the RememberLogin option.

I started looking in to the IDP, IDP Mobile and IDP React modules and found that the IDP server action UserLogin_React calls the System.Login action with the Persistent value set to false. I changed the Persistent value to True.

Republished the IDP, and IDP React modules as well as my Test application.

And behold, my PWA only logs in once and if I disable my internet connection, than the app keeps working and doesn’t try to redirect me to the Azure authentication pages.


So as a proof of concept it is working but I don’t know how I feel about changing the IDP module source in relation to future updates of the module.  

Hi Ibbe,

Glad to know and thanks for the info. This is a good learning. Just make sure that you align it with your security policy specially for offline concerns.

Have a nice day and happy low-coding!

Kind regards,

Chris