Skip to content

Conversation

@g4titanx
Copy link
Contributor

what

Fixes the issue where userProfile in authStore is not populated after authentication, causing downstream apps (e.g., agents-ui) to display "Guest" instead of the authenticated user's name

why

the authStore did not fetch the user profile data (username, email, etc.) after setting the accessToken, nor did it initialize its state using dynamic_authentication_token from Local Storage. This led to userProfile being undefined, affecting apps that rely on useAuthStore to provide user data

how

  • updated authStore.ts to:
    • initialize accessToken, projectId, and isLoggedIn using dynamic_authentication_token from Local Storage on store creation
    • fetch the user profile via GraphQL (Me query) after setting accessToken, retrieving userId, username, email, and avatar from the MySQL database.
    • update userProfile with the fetched data.
  • added error handling for GraphQL fetch failures.
  • made setAccessToken async and updated updateAccessTokenByProjectId to await it

testing

  • unable to test locally due to dependency on GraphQL schema and MySQL database
  • the change is based on Local Storage data from agents-ui, which shows dynamic_authentication_token with a valid email ("g4titan1@gmail.com")
  • please test in a staging environment to confirm userProfile is populated with the correct username (e.g., "g4titan1")

we might consider adding retry logic or a fallback for GraphQL fetch failures if needed

@changeset-bot
Copy link

changeset-bot bot commented May 22, 2025

⚠️ No Changeset found

Latest commit: 9a428b6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@g4titanx g4titanx merged commit eecf5e2 into develop May 22, 2025
3 checks passed
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.

3 participants