Skip to content

fix(web): show the signed-in user in the sidebar instead of "User" - #391

Open
nbmorgan wants to merge 1 commit into
onecli:mainfrom
nbmorgan:sidebar-user-identity
Open

fix(web): show the signed-in user in the sidebar instead of "User"#391
nbmorgan wants to merge 1 commit into
onecli:mainfrom
nbmorgan:sidebar-user-identity

Conversation

@nbmorgan

Copy link
Copy Markdown
Contributor

Closes #390.

Problem

The dashboard sidebar always shows the signed-in user as "User" with no email.

Cause

The client auth provider reads the session via NextAuth useSession(), which
expects { user: { id, email } }. But /v1/auth/session is served by the
OneCLI API and returns the profile flat ({ id, email, name, projectId, organizationId }), so session.user is undefined and the user is treated as
anonymous.

Fix

Read the session the same way the dashboard layout already does — fetch
/v1/auth/session via apiFetch and take id/email/name off the response
root. No dependency on NextAuth's client session shape.

Reproducible on a vanilla install (log in → the sidebar shows "User"); the fix
is independent of the basePath work in #362 / #380.

The sidebar read the session via NextAuths useSession, which expects a
{ user: { id, email } } shape. But /v1/auth/session is served by the OneCLI
API and returns the profile flat ({ id, email, name }), so session.user was
always undefined and the user rendered as "User" with no email.

Read the session the same way the dashboard layout does — via apiFetch to
/v1/auth/session — and take id/email/name off the response root.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

Dashboard sidebar shows "User" instead of the signed-in account

1 participant