Observed since 20 Oct, 17:37 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Core utilities for building OAuth-based integrations in FastAPI applications
A core library for building and managing OAuth-based third-party integrations in FastAPI applications.
abs-integration-core provides a set of reusable components to simplify the implementation of OAuth-based integrations with third-party services. It includes models, schemas, repositories, and a base service class that can be extended for specific integration providers.
pip install abs-integration-core
This package depends on:
fastapi: For API routing and endpoint handlingsqlalchemy: For database ORM functionalitypydantic: For data validationabs-exception-core: For standardized exception handlingabs-repository-core: For base repository pattern implementationabs-auth-rbac-core: For authentication and base modelsThe core model represents an OAuth integration with a third-party provider:
from abs_integration_core.models import Integration
# The Integration model includes:
# - provider_name: String(255)
# - access_token: Text
# - refresh_token: Text
# - expires_at: DateTime
Various Pydantic schemas are available for request/response handling:
from abs_integration_core import (
TokenData,
IsConnectedResponse,
CreateIntegration,
UpdateIntegration,
ResponseSchema
)
# TokenData includes:
# - access_token: str
# - refresh_token: str
# - expires_at: datetime
# Example: Create a standard API response
response = ResponseSchema(
status=200,
message="Integration created successfully",
data=IsConnectedResponse(provider="sharepoint", connected=True)
)
The IntegrationRepository provides data access methods:
from abs_integration_core import IntegrationRepository
# Initialize repository with a database session factory
repo = IntegrationRepository(db_session)
# Available methods:
# - create_integration(integration_data)
# - update_integration(integration_id, update_data)
# - get_by_provider(provider_name)
# - get_all()
# - delete_by_provider(provider_name)
# - refresh_token(provider_name, token_data)
Extend the IntegrationBaseService to implement provider-specific integration services:
from abs_integration_core import IntegrationBaseService
class SharepointIntegrationService(IntegrationBaseService):
def __init__(self, provider_name, integration_repository, encryption):
super().__init__(provider_name, integration_repository, encryption)
def get_auth_url(self, state=None):
# Implementation for generating OAuth URL
async def get_token_data(self, code):
# Implementation for exchanging code for tokens
async def handle_oauth_callback(self, code):
# Implementation for processing OAuth callback
async def refresh_token(self):
# Implementation for refreshing tokens
To implement a new integration provider:
IntegrationBaseServiceget_auth_url()get_token_data(code)handle_oauth_callback(code)refresh_token()from fastapi import APIRouter, Depends
from abs_integration_core import ResponseSchema, IsConnectedResponse
router = APIRouter(prefix="/integration", tags=["integration"])
@router.get("/{provider_name}/connect")
async def integration_connect(
service: IntegrationBaseService = Depends(get_integration_service)
):
auth_data = service.get_auth_url()
return RedirectResponse(url=auth_data["auth_url"])
@router.get("/{provider_name}/callback")
async def integration_callback(
code: str,
service: IntegrationBaseService = Depends(get_integration_service)
):
token_data = await service.handle_oauth_callback(code)
return ResponseSchema(
data=IsConnectedResponse(
provider=service.provider_name,
connected=True
),
message=f"Integration connected successfully"
)
MIT
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.4.0 | 10 Apr 2026 | 7 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 17:37 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:b92b1fde4a5f2a8a30c8a08cb3a1e43a695213dc261d1829c7c47f693f8a2809