Altinn / Altinn/app-frontend-react

Optimize JWT token refresh app-frontend

Open
#105 3 comments 0 reactions 0 assignees View on GitHub
area/authentication kind/analysis ops/performance
Dominant language
TypeScript
Stars
21
Forks
33
Avg merge
6d 23h
Merged PRs (30d)
3

Description

## Description

JWT-token refresh in app-frontend is implemented in a way that it uses "alot" of CPU resources. On a fairly new macbook it jumps from 0.3% (idle) to 3% load when moving the mouse. The increased usage of CPU could be noticeable on a "weaker" pc.

A suggested solution is that we do how netbanks handles sessions, where a little notification shows up a little while before the token expires. It should say something like "Your session is expiring soon, do you want to keep working?" and have an ok-button.

## In scope

- How long is the token valid?
- What must a user do to be classified as active?
- How often should we refresh the token?
- How do we implement the checks if the token should be active?

## Constraints

## Analysis

## Conclusion
> Short summary of the proposed solution.

## Tasks
- [ ] Is this issue labeled with a correct area label?
- [ ] QA has been done

Contributor guide

Open the contributing guide

Research direction

Start by tracing the JWT refresh behavior in app-frontend and measuring CPU usage during mouse movement and token expiry. Define the token lifetime, activity criteria, refresh interval, and notification behavior, then verify that session handling reduces unnecessary CPU use and supports the proposed keep-working flow.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
authentication, frontend, performance
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.