xero-integration-multi-tenant-python

Implement multi-tenant OAuth2 Xero integration with xero-python and Authlib.

42|8|Updated Aug 11, 2025
One-click install
npx skills add https://github.com/XeroAPI/xero-prompt-library --skill xero-integration-multi-tenant-python
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: xero-integration-multi-tenant-python
Source: https://github.com/XeroAPI/xero-prompt-library/tree/main/python
Command: npx skills add https://github.com/XeroAPI/xero-prompt-library --skill xero-integration-multi-tenant-python

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires xero-python, authlib, cryptography, sqlalchemy.

What problem does it solve?

This Skill solves the complexity of building multi-tenant SaaS applications where each end user must connect their own Xero organization, handling the difficult requirements of per-user token storage, OAuth2 PKCE flows, and secure token rotation.

Core Features & Use Cases

  • Multi-Tenant OAuth2 Flow: Implements secure per-user consent redirects and code exchange using Authlib.
  • Production-Ready Token Management: Provides patterns for encrypted token storage, automatic refresh rotation, and request-scoped tenant context.
  • Use Case: A SaaS platform where hundreds of customers connect their individual Xero accounts to sync invoices, requiring robust isolation and reliable API communication.

Quick Start

Use the xero-integration-multi-tenant-python skill to configure the OAuth2 callback and token storage logic for a new multi-tenant Django or FastAPI project.

Frequently Asked Questions about xero-integration-multi-tenant-python

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle multi-tenant Xero OAuth2 token storage for a SaaS application?

Multi-tenant Xero OAuth2 token storage requires per-user encrypted persistence and automatic refresh rotation. This Skill implements secure consent flows and encrypted token storage using cryptography and SQLAlchemy to isolate tenant-specific API operations.

What is the best way to implement Xero OAuth2 PKCE flows in Python?

Implementing Xero OAuth2 PKCE flows in Python requires a secure authorization code exchange mechanism. This Skill uses Authlib to manage PKCE authentication, handling secure consent redirects and code exchange for production SaaS environments.

Can I use xero-python with FastAPI or Django for multi-tenant accounting integrations?

Yes, the xero-python SDK integrates with FastAPI or Django for multi-tenant accounting integrations. This Skill provides the OAuth2 callback and token storage logic needed to configure per-user Xero connections within these web frameworks.

How does per-user tenant context work when connecting multiple Xero organizations?

Per-user tenant context isolates API operations for users connecting multiple Xero organizations by scoping requests to their authenticated tenant. This Skill establishes request-scoped tenant context to ensure robust isolation across connected customer accounts.

How do I ensure idempotent writes and granular scope handling for Xero API operations?

Ensuring idempotent writes and granular scope handling for Xero API operations requires strict OAuth2 scope management and safe request implementation. This Skill satisfies these production requirements by structuring tenant-specific API calls to prevent duplicate records.