Joget DX 8 Stable Released
The stable release for Joget DX 8 is now available, with a focus on UX and Governance.
I think you can use dir_user_meta in the database...PK is username and put meta_key to whatever like "token_session" then put the token value in the meta_value column. You can use #currentUser.meta.KEY to get the token value. ref: Hash Variable - Knowledge Base for DX 8 - Joget | COMMUNITY
Hello
To keep a variable for the lifetime of a login session, you can use session storage provided by your web framework:
Java:
HttpSession session = request.getSession();
session.setAttribute("token", tokenValue);
String token = (String) session.getAttribute("token");
.NET:
Session["token"] = tokenValue;
string token = (string)Session["token"];
PHP:
session_start();
$_SESSION['token'] = $tokenValue;
$token = $_SESSION['token'];
Node.js (Express):
javascriptCopy codereq.session.token = tokenValue;const token = req.session.token;
Python (Flask):
pythonCopy codesession['token'] = token_value;token = session.get('token');
These methods will allow you to store and access a token for the duration of a user's session.
Hey, I suppose this can help you : App Variable
You can make use of this to store the token using JSON and declare the username corresponding to the token fetched and reuse it across the platform.
give it a try.
Hi
Thank you for your reply.
App Variables or Environment variables in Joget are used to store commonly used parameters or settings in the application. They seem to be used as global constants at application level as opposed to session level.
I need to be able to set a local variable and keep reading it, not accessible to any other user, for the life time of the login session. If I use he environment variable as suggested, then I would have to create one environment variable for every user I have in the system...
regards,
You can make use of the app variable to store the token using JSON and declare the username corresponding to the token fetched and reuse it across the platform.
means, declaring all username and map it to the related token for each user theoretically.
Another way is you can make use of the dir_user_meta table
Hash Variable#,User%20Meta,-%23currentUser.meta. and create a column/form element to map the username to correlate directly with the token created externally.
hope it helps!
Thanx Ginger
There is one little issue and that is: few departments, few users use the same user name.
so will need a token to differentiate the users.
regards,
Hi
I am trying to declare a variable that could be used and accessed for a lifetime of a login session.
The reason is I will need to receive a token from another system for every time a user needs to access the application. After each login, the system will ask for the token number, the token number will remain in a variable for the lifetime of the login session. All the transactions on all forms will be saved with this token number. I need to have a variable in the app to keep this token number. Any time a record is going to be saved in the database, I will read the token nr form the variable, this token number will be also updated in the record and then the entire record along with token number will be saved in the database.
Please advise
regards,
Hossein