while am printing logins_count am getting undefined why is that so i have logged many times but still it shows undefined?what i was trying to do if last login is over 40 days want to trigger MFA.
const logins_count= event.stats.logins_count
console.log(“logins_count::;”+logins_count)
Hi @ysharat,
I have tested this on my end, and I am not experiencing the same issue you mentioned. Instead, the event.stats.logins_count
returns the user’s login count.
Are you able to check this with the Real-time Webtask Logs Extension and let me know how it goes?
Thanks,
Rueben
sorry it was not logins_count , i was refering the below one, infact I was not able to get last_login attribute.could you pls try that and see if you able to print it?
const lastLoginString = event.user.last_login; // Get last login timestamp as string
console.log(lastLoginString);
Getting undefined.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
Hi @ysharat,
Thanks for the reply.
Unfortunately, the last_login
attribute is not a callable attribute in the Post-Login action script.
To get the value in the action script, you must use the Management API to get the user’s last_login
. See How can I use the Management API in Actions?.
Alternatively, you could append this information to the user_metadata and get it in the action script (event.user.user_metadata.last_login
).
Thanks,
Rueben