Django OAuth Service for Third-Party POS Integration

Eliminated manual double-entry workflow between Clover POS and locker systems. Designed distributed token management architecture to handle 30-minute OAuth expiration across in-store locker controllers.

Django OAuth Service for Third-Party POS Integration

Project Overview

A locker management software company needed an integration between Clover POS terminals and their distributed locker system. Each restaurant location runs its own locker management server, and staff were manually copying every order from the Clover terminal into the locker interface. It was a time-consuming process prone to errors. Third-party delivery orders (Skip The Dishes, Uber Eats, etc) complicated things further by requiring custom PIN generation based on what each driver's app could display.

  • Timeline: February - August 2024 (part-time), with rollout in November 2024
  • Role: Solo developer
  • Skills: requirements gathering, architecture, development, Docker deployment, and API integration

The Challenge

Adapting to API Changes Mid-Project

Midway through development, we changed authentication from simple bearer tokens to full OAuth token exchanges. This required redesigning the authentication architecture to handle 30-minute token expiration across distributed locker systems.

Distributed Token Management

Each restaurant location runs its own locker server and pulls data from Clover directly, not through a central datacenter. The solution needed a secure token refresh service that any authorized locker could access when tokens expired or were rejected.

External Dependency Outage Mitigation

I designed a system for handling outages with third-party services. The system handles failures gracefully. There is monitoring on the token exchanges.

Complex Data Transformation

Mapping order data between Clover's schema and the locker system's format involved reconciling different entity relationships, inconsistent data types (strings vs numbers), and parsing human-readable strings from third-party delivery integrations.

System Architecture

System Architecture

The Solution

I built a standalone Django application serving as a secure OAuth token exchange service, with the following architecture:

OAuth Token Exchange Service

Built a centralized Django application that handles Clover's OAuth flow and manages token lifecycle. When Clover migrated from simple bearer tokens to OAuth mid-project, I redesigned the authentication layer to handle 30-minute token expiration across all distributed locker locations.

Distributed Token Refresh

Rather than centralizing all API calls, each locker location authenticates to the Django app using long-lived bearer tokens. When a locker's Clover token expires (every ~30 minutes) or is rejected, it requests a fresh token from the central service. This allows the distributed locker servers to maintain their own direct connections to Clover's API while ensuring secure token management.

Security Layer

  • TLS encryption for all token exchanges
  • Bearer token authentication to prevent unauthorized token requests
  • Rate limiting to protect against abuse

Near Real-time Order Synchronization

Implemented Celery background workers to poll Clover's API at regular intervals, transforming and importing orders into each locker system. Email alerts notify operators of failures, with automatic retry logic that continues polling until Clover's API recovers from outages.

Data Transformation Pipeline

Built adapters to map between Clover's order schema and the locker system's expected format, handling inconsistent data types and parsing third-party delivery order strings into structured data.

Production-Ready Deployment

Containerized the entire application with Docker for rapid redeployment and health monitoring, ensuring the token service remains available to distributed locker locations.

Screen capture

Screen capture

Results

The application successfully passed internal QA and received positive feedback from the client's technical team. The system handled the core integration challenges:

  • Automated order flow from Clover POS to lockers, eliminating manual double-entry
  • Secure, distributed token management across multiple locker locations
  • Resilient handling of Clover's periodic API outages
  • Support for both direct in-store entry and third-party delivery orders

Key Takeaway

This project demonstrates adaptability in the face of changing requirements, from mid-project API authentication changes to evolving business needs, while maintaining focus on delivering working software that solves real operational problems.

References

Let's Work Together

I'm based in Victoria, British Columbia and I work with clients across North America. If you're an agency that needs a reliable Django contractor, or a startup trying to get something built, I'd love to hear from you.

Schedule a free 30-minute consultation to talk about your needs. No commitment required.

Start a conversation