feat: Implement OAuth authorization endpoints for Google Drive, SharePoint, Slack, and Teams
Add OAuth flow management endpoints to handle user authorization for cloud providers.
New Endpoints
- POST /api/izemx-core-n8n/oauth/{provider}/authorize - Initiate OAuth flow
- GET /api/izemx-core-n8n/oauth/{provider}/status/{stateToken} - Check OAuth status
- GET /api/izemx-core-n8n/oauth/{provider}/callback - OAuth callback handler
New Files
- Integration/models/oauth_state.py - OAuth state model for temporary authorization states
- Integration/schemas/oauth.py - Pydantic schemas for OAuth requests/responses
- Integration/services/oauth_service.py - OAuth service with provider-specific logic
- Integration/integrations_oauth_api.py - FastAPI router for OAuth endpoints
- Integration/migrations/002_create_oauth_states.sql - Database migration for oauth_states table
- Integration/tests/test_oauth_api.sh - Test script for OAuth endpoints
- Integration/OAUTH_SETUP.md - OAuth configuration documentation
Modified Files
- Integration/models/init.py - Export OAuthState model
- Integration/schemas/init.py - Export OAuth schemas
- Agent/api_app.py - Include OAuth router
- Agent/scripts/init_integrations_db.py - Include OAuthState in database initialization
Features
- Support for Google Drive, SharePoint, Slack, and Teams OAuth flows
- State token management with 10-minute expiration
- Automatic account creation in user_oauth_accounts after successful OAuth
- HTML callback page that closes popup window
- Provider-specific OAuth URL construction and token exchange
Configuration Required
Environment variables needed for each provider:
- GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, GOOGLE_REDIRECT_URI
- MICROSOFT_CLIENT_ID, MICROSOFT_CLIENT_SECRET, MICROSOFT_TENANT_ID, MICROSOFT_REDIRECT_URI
- SLACK_CLIENT_ID, SLACK_CLIENT_SECRET, SLACK_REDIRECT_URI