Skip to content

feat: add manual token refresh, time-based filters, and fix provider auth issues#297

Open
fgogolli wants to merge 10 commits intodecolua:masterfrom
fgogolli:fix/kiro_auth_models_cost
Open

feat: add manual token refresh, time-based filters, and fix provider auth issues#297
fgogolli wants to merge 10 commits intodecolua:masterfrom
fgogolli:fix/kiro_auth_models_cost

Conversation

@fgogolli
Copy link

Summary

Bug fixes and enhancements for provider authentication and usage tracking.

Key Changes

Critical Fixes

Kiro Provider:

  • Restored token-based cost calculation
  • Fixed connection deduplication and device code flow
  • Added missing models to pricing table

Other Providers:

  • Fixed 401 token expiry with refreshCredentials implementation

Usage Tracking

  • Fixed SSE stream overwriting filtered stats
  • Corrected period filtering and custom date range logic

New Features

Kiro Enhancements:

  • Manual token refresh capability
  • ProfileArn + AWS region support
  • Improved usage API

Usage Analytics:

  • Time-based filters (hourly/daily/weekly/monthly/custom)
  • TimeRangeModal component for date selection
  • Clear metrics endpoint

… and perf optimizations

- Add predefined time range filters (5m, 15m, 30m, 1h, 24h, 48h, 7d, 30d, all)
- Add custom date range picker via TimeRangeModal component
- Add clear metrics functionality with confirmation dialog
- Add auto-refresh toggle with smart polling interval adjustment
- Add tokens/costs view mode toggle
- Optimize getUsageStats() with cached pricing lookups for faster 24h/48h filters
- Preserve scroll position during auto-refresh
- Add /api/usage/clear route
… support, and usage API improvements

- Add manual token refresh button to Providers page
- Add /api/oauth/refresh route for on-demand token refresh
- Extract profileArn from AWS SSO OIDC response and access token JWT
- Store and use AWS region for GetUsageLimits API calls
- Make profileArn optional for Kiro GetUsageLimits API call
- Improve Kiro usage API error handling with user-friendly messages
- Always preserve providerSpecificData during token refresh
- Allow manual token refresh anytime, not just when expiring soon
- Preserve scroll position during auto-refresh
- Add credit-based pricing for Kiro
- Extract profileArn in auto-import flow
…code, and misc fixes

- Make Kiro auth URL configurable with Builder ID form (profile page setting)
- Add kiroAuthUrl to localDb settings defaults
- Prevent duplicate device code generation in React Strict Mode
- Regenerate device code when Kiro deviceConfig changes
- Use clientId alone as unique identifier for Kiro connections
- Make Kiro behave like Antigravity - update existing connections on re-auth
- Fix correct field name tokenExpiresAt when creating OAuth connections
- Fix hydration error by removing comments from colgroup
- Make Kiro error messages more concise
- Ensure startUrl is captured from config in device code response
- Add KiroAuthModal and KiroOAuthWrapper improvements
- Add getSettings/isCloudEnabled imports to OAuth route
- Add Kiro and other models to providerModels
@fgogolli
Copy link
Author

@decolua This fixes the Kiro integration with AWS Orgs and Pro accounts - and also adds some useful features like token refresh for APIs that support it (OIDC accounts mostly), as well as usage data cleanup and more granular time filters. Also fixes some bugs int he refresh of # of requests, tokens and cost when filtering the data.

Due to the files it touches, might be good to merge this before there is more conflicts to resolve and I think would be useful for those of us who use it with Kiro. (I currently run a local fork as the current releases dont work with Kiro hosted on AWS Orgs at all).

Let me know if you need any further details.

@decolua
Copy link
Owner

decolua commented Mar 13, 2026

Thanks for your support, I will merge as soon as possible

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