Skip to content

Fix 500 error when user has no data access token#11909

Open
Gautam-aman wants to merge 1 commit intocBioPortal:masterfrom
Gautam-aman:fix-dat-empty-list
Open

Fix 500 error when user has no data access token#11909
Gautam-aman wants to merge 1 commit intocBioPortal:masterfrom
Gautam-aman:fix-dat-empty-list

Conversation

@Gautam-aman
Copy link

Problem

Calling getDataAccessToken for a user with no existing data access tokens
throws an IndexOutOfBoundsException, resulting in a 500 response.

Solution

Guard against an empty token list and create a new data access token
when none exists.

Impact

Prevents server error and aligns behavior with expected token lifecycle.

Tests

  • mvn test -Dtest=UuidDataAccessTokenServiceImplTest

Fixes #11905

@sachindigharra
Copy link

Issue: The user is still logged into the system but doesn’t have a token to access resources.
Solution: Since the user is already verified, we should generate and store a token instead of re-verifying. This ensures that future resource access is not interrupted.

@Gautam-aman
Copy link
Author

Yes, exactly this change ensures that already-authenticated users receive
a newly generated and persisted data access token when none exists, avoiding
re-verification and preventing 500 errors on resource access.

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.

[BUG] IndexOutOfBoundsException in UUID getDataAccessToken

2 participants