We have Community with two-factor authentication in place, implemented in Login flow. We would like the second factor to be requested only once per 30 days on the device. If the user comes from another device, the second factor needs to be enforced. We wanted to leverage Login History but there is no unique identifier of the device. We wanted to use cookie based on this page, but no matter what we set to maxAge, it still expires after the browser is closed. Any suggestion what we could do? Is there a way to set Expires instead of maxAge?

  • 1
    I'm pretty sure you can only use persistent cookies in Salesforce Sites, not in Communities, but I'm having a hard time finding documentation to confirm that. I'll keep looking for a bit, and see whether there might be an alternate solution. – Shane Steinfeld Sep 22 at 15:29
up vote 0 down vote accepted

As a solution, we build custom javascript method to create and check the cookie. It is triggered during the login flow.

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.