File Upload fails if authentication token is refreshed while on submission form (401Unauthorized error) #3979
Labels
authentication: general
general authentication issues
bug
component: submission
help wanted
Needs a volunteer to claim to move forward
high priority
Description
Hi,
Some of our users have reported encountering errors when uploading files after a certain period of time. Specifically, the DSpace client displays an “Error Loading File” message once the JWT token is renewed by the front-end client.
This issue arises when a user’s submission process exceeds 30 minutes. The front-end client renews the token 2 minutes before session timeout; however, it does not use the new token if the user attempts to upload files after the renewal.
We are currently using DSpace 7.6.2. Could you provide any insights or recommendations on resolving this issue?
Thanks.
Steps to Reproduce
Steps to reproduce the behavior:
Expected behavior
The JWT token timeout is set to 30 minutes. By default, the client renews the token 2 minutes before expiration. Once the new token is received, it should be used for all subsequent file uploads without failure.
Observed Issue
Currently, file uploads continue to use the expired token instead of the newly issued one.
On failed upload requests, the Bearer token in the request header differs from the token stored in the cookie, indicating a mismatch.
Screenshots:
In the screenshot below, I monitored network traffic using Google Chrome Developer Tools
Image1: Three uploads were done successfully
Image 2: DSpace renews the token. This happens 2 min before it expires.
Image 3: All uploads attempts fail after the token renewal. I attempted to upload two files.
Image 4: The failed upload request contains a different token in the header compared to the one in the cookie. It uses the old one in the header, and the new one in the cookie.
The text was updated successfully, but these errors were encountered: