Skip to content

Conversation

Lauritz-Tieste
Copy link
Contributor

Problem

User description of the error: ‘The website keeps logging me out of the video page after a short time. Whenever I finish a chapter in the course and mark it as “done”, it kicks me out.’

Users were experiencing frequent logouts when watching course videos and completing chapters. The issue occurred because:

  1. JWT access tokens have short expiration times
  2. During video watching, no API calls are made, causing tokens to expire silently
  3. When users complete chapters and mark them as done, the expired token triggers automatic logout

Solution

TokenManager Service

  • Monitors token expiration every minute in the background
  • Automatically refreshes tokens when they have 5 minutes remaining

Activity-Aware Token Management

  • Tracks video watching activity via timeupdate events
  • Ensures token freshness before critical actions like chapter completion
  • Automatically starts monitoring when users enter course watch pages, stops monitoring when leaving

@Lauritz-Tieste Lauritz-Tieste added the bug Something isn't working label Aug 13, 2025
Copy link

Preview deployed to https://bf55b8ba.academy-preview.pages.dev (total size: 15M)

@Lauritz-Tieste Lauritz-Tieste requested a review from Defelo August 13, 2025 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant