Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

LG-12214: Refresh device cookie on every user event #10606

Merged
merged 4 commits into from May 13, 2024

Conversation

aduth
Copy link
Member

@aduth aduth commented May 10, 2024

馃帿 Ticket

LG-12214

馃洜 Summary of changes

Ensures that the "permanent" device cookie is effectively permanent by re-assigning it on each user event.

Additional background from the ticket:

When a user signs in to Login.gov, we set a cookie to uniquely identify that device so that it is remembered for subsequent sign-ins. As seen in the linked code, the cookie is intended to be permanent, which is documented as expiring "in 20 years from now". However, some browsers may impose limits on the duration of cookies. Chrome sets a maximum cookie expiration to 400 days.

Because of this, a user who signs in with the same Chrome device after 400 days will be treated as a new device, thereby triggering new device notifications, and creating a new device entry in the user's account dashboard.

As documented on the same blog post, there are no restrictions which prevent us from refreshing the cookie expiration every time the user signs-in. Currently we do not do this, since we only set the cookie if the cookie isn't already set.

馃摐 Testing Plan

  1. Go to http://localhost:3000
  2. Sign in
  3. Open "Cookies" tab in browser dev tools to see your cookies
  4. Take note of the expiration of the "device" cookie
  5. Sign out
  6. Repeat Steps 2-4
  7. Observe that the expiration date is extended on your second sign-in

changelog: Bug Fixes, New Device Detection, Extend duration of permanent device cookie on every user event
@aduth aduth marked this pull request as ready for review May 10, 2024 20:31
@aduth aduth changed the title LG-12214: Refresh device cookie on every user action LG-12214: Refresh device cookie on every user event May 10, 2024
@aduth aduth merged commit 441f085 into main May 13, 2024
2 checks passed
@aduth aduth deleted the aduth-lg-12214-permanent-device-cookie branch May 13, 2024 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants