Skip to content

Conversation

@bokelley
Copy link
Contributor

Summary

Completes the OAuth flow fixes to enable smooth Google authentication with proper tenant selection UX.

Changes

1. Fix Missing is_admin Field (Fix #1)

Issue: After successfully selecting a tenant, users got a 500 error because the code tried to access tenant["is_admin"] but the field wasn't included in the session data.

Root Cause: During the unified OAuth flow refactoring, we removed the is_admin field when building the available_tenants list.

Fix: Restore the is_admin logic:

  • Domain users: Always get admin access (is_admin=True)
  • Email-based users: Check User table for role, default to admin

2. Improve Tenant Selector UX (Fix #2)

Issues:

  • Primary action had white background, less prominent than secondary action
  • "Create New Account" was bright green and most prominent (wrong hierarchy)
  • "Cancel" button was confusing (nowhere useful to cancel to)
  • Verbose and unclear copy

Improvements:

  • Primary button: Now btn-primary btn-lg w-100 (blue, large, full width)
  • Secondary button: Changed to btn-outline-secondary (gray outline, less prominent)
  • Removed "Cancel": User is authenticated, nowhere meaningful to cancel to
  • Better visual hierarchy: Clear separator with "Don't see your account?" text
  • Enhanced selection: Blue highlight on selected/hover states
  • Cleaner copy: "Select an account to continue"

Testing

  • ✅ OAuth authentication works end-to-end
  • ✅ Tenant selection no longer throws 500 error
  • ✅ Visual hierarchy is clear - primary action is obvious
  • ✅ Both domain-based and email-based tenant access work correctly

Related PRs

Screenshots

Before: Primary action was less prominent than "Create New Account"
After: Clear visual hierarchy with blue primary button and gray outline secondary

🤖 Generated with Claude Code

bokelley and others added 2 commits October 27, 2025 22:52
**Issue**: Users selecting a tenant after OAuth would get a 500 error
because the code tried to access tenant["is_admin"] (line 316) but
the available_tenants list didn't include that field.

**Root Cause**: During the unified OAuth flow refactoring, we removed
the is_admin field from the available_tenants dict when building it
in the OAuth callback (lines 274-289).

**Fix**: Restore the is_admin logic:
- Domain users: Always get admin access (is_admin=True)
- Email-based users: Check User table for role, default to admin

This matches the previous implementation and allows tenant selection
to work correctly.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
**Issues**:
1. Primary action ("Continue") had white background, less prominent than secondary action
2. "Create New Account" was bright green and most prominent (wrong hierarchy)
3. "Cancel" button was confusing - nowhere useful to cancel to
4. Copy was verbose and unclear

**Improvements**:
- Primary button: Now btn-primary btn-lg w-100 (blue, large, full width)
- Secondary button: Changed to btn-outline-secondary (gray outline, less prominent)
- Removed "Cancel" button entirely (user is authenticated, nowhere to cancel to)
- Better visual hierarchy with separator and "Don't see your account?" text
- Enhanced tenant selection with blue highlight on selected/hover
- Cleaner copy: "Select an account to continue"

**Result**: Clear visual hierarchy - primary action is obvious, secondary is available but not distracting.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@bokelley bokelley merged commit 875d65a into main Oct 28, 2025
9 checks passed
danf-newton pushed a commit to Newton-Research-Inc/salesagent that referenced this pull request Nov 24, 2025
…tocol#653)

* fix: Add missing is_admin field to tenant selection data

**Issue**: Users selecting a tenant after OAuth would get a 500 error
because the code tried to access tenant["is_admin"] (line 316) but
the available_tenants list didn't include that field.

**Root Cause**: During the unified OAuth flow refactoring, we removed
the is_admin field from the available_tenants dict when building it
in the OAuth callback (lines 274-289).

**Fix**: Restore the is_admin logic:
- Domain users: Always get admin access (is_admin=True)
- Email-based users: Check User table for role, default to admin

This matches the previous implementation and allows tenant selection
to work correctly.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: Improve tenant selector UX with proper button hierarchy

**Issues**:
1. Primary action ("Continue") had white background, less prominent than secondary action
2. "Create New Account" was bright green and most prominent (wrong hierarchy)
3. "Cancel" button was confusing - nowhere useful to cancel to
4. Copy was verbose and unclear

**Improvements**:
- Primary button: Now btn-primary btn-lg w-100 (blue, large, full width)
- Secondary button: Changed to btn-outline-secondary (gray outline, less prominent)
- Removed "Cancel" button entirely (user is authenticated, nowhere to cancel to)
- Better visual hierarchy with separator and "Don't see your account?" text
- Enhanced tenant selection with blue highlight on selected/hover
- Cleaner copy: "Select an account to continue"

**Result**: Clear visual hierarchy - primary action is obvious, secondary is available but not distracting.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <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.

2 participants