Skip to content

Add authentication and API integration to samples app #102

Description

@wendellmva

Issue: Add authentication and API integration to samples app

Summary

Integrate authentication (login/logout) and connect the samples app to the Graph API and database, making all use cases work with real user data and live CRUD operations.

Goals

  • Add login/logout functionality to samples app
  • Integrate with Graph API authentication endpoints
  • Connect use cases to real backend/database
  • Enable authenticated CRUD operations
  • Make app fully functional with real data

Scope

  1. Authentication UI:
    • Add login page/component
    • Add logout functionality
    • Display user info when logged in
    • Add authentication state management
  2. API Integration:
    • Create API client service
    • Configure API base URL (environment-based)
    • Implement JWT token storage/refresh
    • Add authorization headers to requests
  3. Connect to GraphContext:
    • Wire up SPEC0200-0204 CRUD operations
    • Connect use cases to real data:
      • GitHub Issue tracker → real issues in graph
      • Kanban Board → real tasks/workflow
      • Todo List → real user todos
  4. User Context:
    • Store authenticated user info
    • Filter data by logged-in user
    • Implement user-scoped operations

Acceptance Criteria

  • Users can login with username/password
  • JWT token stored and sent with API requests
  • Users can logout and token is cleared
  • Protected routes require authentication
  • Use cases (GitHub Issue, Kanban, Todo) work with real user data
  • CRUD operations persist to database via API
  • User can only see/modify their own data
  • Token refresh works when token expires
  • Clear error messages for auth failures

Technical Implementation

  1. AuthenticationService:
    • Login/logout methods
    • Token storage (localStorage/sessionStorage)
    • Token refresh logic
    • User state management
  2. ApiClient Service:
    • Base HTTP client with auth headers
    • Methods for CRUD operations
    • Error handling
  3. AuthenticationStateProvider:
    • Track authentication state
    • Provide user claims
  4. Protected Routes:
    • Redirect to login when not authenticated
    • Show/hide UI based on auth state

API Endpoints Needed

  • POST /api/auth/login
  • POST /api/auth/logout
  • POST /api/auth/refresh
  • GET /api/auth/user
  • CRUD endpoints for nodes, edges, types, properties

Checklist

  • Create login page/component
  • Implement AuthenticationService
  • Add AuthenticationStateProvider
  • Create ApiClient service
  • Configure API base URL (appsettings)
  • Implement token storage and refresh
  • Add authorization to HTTP requests
  • Connect GitHub Issue page to real API
  • Connect Kanban Board to real API
  • Connect Todo List to real API
  • Add user-scoped data filtering
  • Implement protected routes
  • Add logout functionality
  • Test full authentication flow
  • Handle token expiration gracefully

Dependencies

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium prioritySP:88 story points (extra large)featureNew featureshellShell/UI component

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions