feat(connector-superoffice): implement OAuth 2.0 flow and S2S architecture
Completed POC for SuperOffice integration with the following key achievements: - Switched from RSA/SOAP to OAuth 2.0 (Refresh Token Flow) for better compatibility with SOD environment. - Implemented robust token refreshing and caching mechanism in . - Solved 'Wrong Subdomain' issue by enforcing for tenant . - Created for REST API interaction (Search, Create, Update UDFs). - Added helper scripts: , , . - Documented usage and configuration in . - Updated configuration requirements. [2ff88f42]
This commit is contained in:
36
connector-superoffice/discover_fields.py
Normal file
36
connector-superoffice/discover_fields.py
Normal file
@@ -0,0 +1,36 @@
|
||||
import os
|
||||
import logging
|
||||
import json
|
||||
from dotenv import load_dotenv
|
||||
from auth_handler import AuthHandler
|
||||
from superoffice_client import SuperOfficeClient
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
def discover_fields():
|
||||
load_dotenv(dotenv_path="../.env")
|
||||
auth = AuthHandler()
|
||||
client = SuperOfficeClient(auth)
|
||||
|
||||
logger.info("Fetching metadata to discover UDF fields...")
|
||||
|
||||
# Get metadata for Contact (Company)
|
||||
url = client._get_url("v1/Metadata/Contact/UserDefinedFields")
|
||||
try:
|
||||
resp = client.session.get(url, headers=client._get_headers())
|
||||
resp.raise_for_status()
|
||||
fields = resp.json()
|
||||
|
||||
print("\n--- AVAILABLE UDF FIELDS ---")
|
||||
for field in fields.get("value", []):
|
||||
print(f"Label: {field.get('FieldLabel')} -> Technical Name: {field.get('ProgId')} (Type: {field.get('FieldType')})")
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to fetch metadata: {e}")
|
||||
if hasattr(e, 'response') and e.response is not None:
|
||||
print(f"Details: {e.response.text}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
discover_fields()
|
||||
|
||||
Reference in New Issue
Block a user