feat(auth): save OAuth credentials per-user to UserIntegration records
- Add 'Authorize' button to integration cards for OAuth types without credentials
- Add isOAuthType() helper and update info box in create/edit modal
- Accept integration_id query param in Dropbox, Google Drive, OneDrive setup views
- Store integration_id in sessionStorage on setup pages
- Add per-user flow in OAuth callbacks: PUT credentials to /api/integrations/{id}
- Preserve existing global flow as fallback when no integration_id is present
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
OneDrive integration views for setup and OAuth callback.
|
||||
"""
|
||||
|
||||
from fastapi import Request
|
||||
from fastapi import Query, Request
|
||||
|
||||
from app.views.base import APIRouter, require_login, settings, templates
|
||||
|
||||
@@ -11,7 +11,7 @@ router = APIRouter()
|
||||
|
||||
@router.get("/onedrive-setup")
|
||||
@require_login
|
||||
async def onedrive_setup_page(request: Request):
|
||||
async def onedrive_setup_page(request: Request, integration_id: int | None = Query(None)):
|
||||
"""
|
||||
Setup page for the OneDrive integration.
|
||||
Shows configuration status and setup instructions.
|
||||
@@ -35,6 +35,7 @@ async def onedrive_setup_page(request: Request):
|
||||
"refresh_token": bool(settings.onedrive_refresh_token),
|
||||
"refresh_token_value": settings.onedrive_refresh_token if settings.onedrive_refresh_token else "",
|
||||
"folder_path": settings.onedrive_folder_path or "Documents/Uploads", # Default folder path
|
||||
"integration_id": integration_id,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user