Persistent session and using callback URLs
-
Radostin MinchevHas successfully completed the online course Basics (100)1 year ago #35086
Hello,
I have an app with multiple screens, but at some point, I have to redirect to an external website in order to sign some documents. I can pass a callback URL that will be called after the papers are signed. The problem is that when I redirect back to my Simplifier application, I am sent to the login screen, and I have to start the process from the being. Is there a way to make the Simplifier session persistent so I can go back to a specific screen on my app?
Thank you!
Jennifer HäfnerHas successfully completed the online course Intermediate (200)Has successfully completed the online course Advanced (300)Has successfully completed the online course Basics (100)Has successfully completed the online course Advanced (310)Has successfully completed the online course Advanced (320)Has successfully completed the Intermediate CertificationHas successfully completed the Advanced Certification1 year ago #35095::Hi Radostin,
There is no automatic way of saving a session in Simplifier. But you can implement it using URL query parameters:
- Before leaving the Simplifier app, store all relevant data in a database, add a key as identifier (can be an autogenerated session key)
- When reopening the Simplifier app: append the session key to the URL as a query parameter
- With the autofield ‘URL’ – ‘query parameter’, you can read the value of the URL query parameter
- If the query parameter with the session key is not empty, navigate to the screen that you were showing when you left the app, and load the relevant data from the database with the session key
- If the query parameter with the session key is not given or invalid, open the application in the usual way (starting with the login screen)
You can find an example of using the query parameter autofield to control application logic in our Intermediate course, module 8, lesson 4: https://community.simplifier.io/207-4/
Jennifer HäfnerHas successfully completed the online course Intermediate (200)Has successfully completed the online course Advanced (300)Has successfully completed the online course Basics (100)Has successfully completed the online course Advanced (310)Has successfully completed the online course Advanced (320)Has successfully completed the Intermediate CertificationHas successfully completed the Advanced Certification1 year ago #35096::Important note:
When you are reopening the application again with the query parameter for the session key, you need to implement a user-login again because on reloading the app, the old login is lost.
You have two options for that:
- Let the user login once again manually
- Perform the login automatically in the background.
For this option, you have to store the previous user token in the database as well (retrieve it with the client-side business object ‘ITIZ_Utilities – GetUserToken’.
Then, when loading the session data, you can trigger the login process with the following code snippet:
this.Permission._setAjaxHeader(<the user token>);
Let me know if you have any questions.
You must be logged in to reply to this topic.