AhmadHassan-BTed /ShopifyAutoAuth

Enterprise-grade Shopify Admin API authentication adapter — OAuth 2.0 Client Credentials Grant with automatic token refresh.

★ 4,709⑂ 0👁 0⑃ 6● 0▤ 1◈ 0
PythonMITCreated 2026-08-20pypi.org/project/shopify-auth-adapter/
4,709
stars
+7
0
forks
0
watchers
6
prs
0
issues
1
releases
0
discussions

README

ShopifyAutoAuth

Enterprise-Grade Shopify OAuth 2.0 Client Credentials Adapter


  A zero-friction, production-hardened bridge connecting legacy Shopify applications to modern Client Credentials Grant authentication.






![Maintainer-8a2be2?style=for-the-badge)](https://github.com/AhmadHassan-BTed)

---



 Overview

Following Shopify's mandatory authentication migration on January 1, 2026, static shpat_xxx custom app tokens were deprecated in favor of OAuth 2.0 Client Credentials Grant short-lived access tokens (RFC 6749 §4.4).

shopify_auth_adapter provides a transparent authentication proxy. Existing applications can preserve their variable assignment patterns while under the hood tokens are acquired, cached in volatile RAM, and refreshed prior to expiration without runtime interruption.

 Migration: Before vs After

python
 BEFORE (Deprecated static token):
SHOPIFY_ACCESS_TOKEN = "shpat_xxxxxxxxxxxxxxxxxxxxxxxx"

 AFTER (Automatic OAuth 2.0 token with auto-refresh):
from shopify_auth_adapter import get_access_token

SHOPIFY_ACCESS_TOKEN = get_access_token()


---

 ⚡ Quick Start: 1 Line of Code

To upgrade any Python application to Shopify's modern OAuth 2.0 authentication, replace your deprecated shpat_xxx string with get_access_token():

python
from shopify_auth_adapter import get_access_token

 Automatically fetches, caches in RAM, and auto-refreshes OAuth 2.0 tokens:
SHOPIFY_ACCESS_TOKEN = get_access_token()


That's it! Everything else (OAuth 2.0 requests, RAM caching, automatic 24h refresh) happens automatically behind the scenes.

 Installation

bash
pip install shopify-auth-adapter


 Setting Up Credentials

You can supply your Shopify Dev Dashboard credentials in any of 3 ways:

 Option A: In a .env file (Recommended for Local Dev)
Create a .env file in your project root:
env
SHOPIFY_SHOP=your-store.myshopify.com
SHOPIFY_CLIENT_ID=your_client_id
SHOPIFY_CLIENT_SECRET=your_client_secret


 Option B: Environment Variables (Production / Docker / Cloud)
Set variables in your terminal or deployment environment:
bash
export SHOPIFY_SHOP="your-store.myshopify.com"
export SHOPIFY_CLIENT_ID="your_client_id"
export SHOPIFY_CLIENT_SECRET="your_client_secret"


 Option C: Pass Directly in Python Code
python
from shopify_auth_adapter import get_access_token

token = get_access_token(
    shop="your-store.myshopify.com",
    client_id="your_client_id",
    client_secret="your_client_secret",
)


---

 Testing Credentials

You can verify your Dev Dashboard credentials and store connection instantly by running the included tester script:

bash
python examples/test_credentials.py


---

 Usage Examples

 1. Drop-In Token Helper

python
import httpx

from shopify_auth_adapter import get_access_token

 Automatically reads credentials from .env or environment variables:
headers = {"X-Shopify-Access-Token": get_access_token()}
response = httpx.get(
    "https://your-store.myshopify.com/admin/api/2026-07/shop.json",
    headers=headers,
)


 2. High-Lev

Latest release

v1.0.0 - Initial Release v1.0.0 2026-08-20
Production-quality Python library for Shopify OAuth 2.0 Client Credentials Grant with automatic token refresh.

Full Changelog: https://github.com/AhmadHassan-BTed/ShopifyAutoAuth/commits/v1.0.0

Snapshot: 2026-11-10T09:35:25Z · Data license Apache-2.0 · JSON