async def create_credentials_from_authorization_code(
    *,
    db: AsyncSession = Depends(deps.get_db),
    source_short_name: str,
    code: str = Query(..., description="The authorization code to exchange"),
    credential_name: Optional[str] = Body(None),
    credential_description: Optional[str] = Body(None),
    client_id: Optional[str] = Body(None),
    client_secret: Optional[str] = Body(None),
    user: schemas.User = Depends(deps.get_user),
) -> schemas.IntegrationCredentialInDB:
    """Exchange OAuth2 code for a token and create integration credentials.

    This endpoint:
    1. Exchanges the authorization code for a token
    2. Creates and stores integration credentials with the token
    3. Returns the created credential

    Args:
        db: The database session
        source_short_name: The short name of the source
        code: The authorization code to exchange
        credential_name: Optional custom name for the credential
        credential_description: Optional description for the credential
        client_id: Optional client ID to override the default
        client_secret: Optional client secret to override the default
        user: The current user

    Returns:
        The created integration credential
    """
    return await source_connection_service.create_credential_from_oauth2_code(
        db=db,
        source_short_name=source_short_name,
        code=code,
        credential_name=credential_name,
        credential_description=credential_description,
        client_id=client_id,
        client_secret=client_secret,
        current_user=user,
    )
Exchange OAuth2 code for a token and create integration credentials.

    This endpoint:
    1. Exchanges the authorization code for a token
    2. Creates and stores integration credentials with the token
    3. Returns the created credential

    Args:
        db: The database session
        source_short_name: The short name of the source
        code: The authorization code to exchange
        credential_name: Optional custom name for the credential
        credential_description: Optional description for the credential
        client_id: Optional client ID to override the default
        client_secret: Optional client secret to override the default
        user: The current user

    Returns:
        The created integration credential
    
backend/airweave/api/v1/endpoints/source_connections.py