Redirecting to requested screen after login in mobile

Hello you all ,


When session expires and user click on link of screen which requires login but it redirect users to login page but when supplying the credentials users is redirected to landing page of the application

Need help on : How to redirect user to previously requested screen after login in outsystems mobile app 


Thanks,

Nitesh 

Hello Nitesh,

In order to achieve this, you can save the current URL of your page in the Local Storage of the device.

Everytime the user enters in a screen, you need to save (update) the URL.

By the time the user logs in, you can check the Local Storage value for this URL. If it is empty, then you redirect to Landing Page. If not, then you redirect to that URL.

You need to clear this value if the user logs out of the app.


Kind regards,

Rui Barradas

Rui Barradas wrote:

Hello Nitesh,

In order to achieve this, you can save the current URL of your page in the Local Storage of the device.

Everytime the user enters in a screen, you need to save (update) the URL.

By the time the user logs in, you can check the Local Storage value for this URL. If it is empty, then you redirect to Landing Page. If not, then you redirect to that URL.

You need to clear this value if the user logs out of the app.


Kind regards,

Rui Barradas

Hello Rui,

Thanks for your reply but i have performance concerns for this approach since i need to update the local storage on every page. 

Secondly i need to store url of the page when user hits after session is expired. 

Eg. i am on screen "abc" in app, session is now expired and i click link to page "xyz" and app is redirected to login page ...now after login in, app should redirect to page "xyz".

Can i store page "xyz" link in local storage even if session is expired?

 

Hi Nitesh,

You can use Client Variable and store page URL here.


Based on you can redirect page URL.


Regards
Rahul

Rahul Sahu wrote:

Hi Nitesh,

You can use Client Variable and store page URL here.


Based on you can redirect page URL.


Regards
Rahul

 Hey Rahul,

nice to see you , but pages which requires session when clicked cannot capture there url , it redirects user to login page. Requested page's initialise is not called in this case.

 

Hello Nitesh Ahirwar,

You should create an action that will be performed right before you navigate to the destination screen. 

This action will be responsible for building the destination URL with available Built-in functions (GetOwnerURLPath(), GetBookmarkableURL()...) and then updating this variable stored on locale storage. 

Give it a try and tell me if it worked ;)

Regards,

Tomás 

Tomás Dionísio wrote:

Hello Nitesh Ahirwar,

You should create an action that will be performed right before you navigate to the destination screen. 

This action will be responsible for building the destination URL with available Built-in functions (GetOwnerURLPath(), GetBookmarkableURL()...) and then updating this variable stored on locale storage. 

Give it a try and tell me if it worked ;)

Regards,

Tomás 

*By using built-in fuctions, you can check examples like

 HTTPRequestHandler (GetEntryUrl)      

In order to get the destination URL