Skip to main content

Python Auth Library that exposes utility functions to authenticate SmoothCode requests

Project description

SmoothCode Auth Python

Tests

Introduction

Python Auth Library that exposes utility functions to authenticate SmoothCode requests

Installation

  • Supported python versions
>= python3
  • Install using
pip install smoothcode_auth

Usage

This library exposes 2 methods

  • is_dashboard_request(shop) - This method verifies if the request for accessing the dashboard is coming from SmoothCode
from smoothcode_auth import SmoothCodeAuth

# SmoothCode sends query parameters to the URL
# shop -> Shopify Shop in the form: `test.myshopify.com`
# hmac -> HMAC of the shop signed by your App Client Secret (can be obtained from SmoothCode Dashboard in App Settings) 

SmoothCodeAuth(request_hmac, client_secret).is_dashboard_request(shop) # returns True if the request is valid
  • is_webhook_request(webhook_data) - This method verifies if the webhook request is coming from SmoothCode
from smoothcode_auth import SmoothCodeAuth

# SmoothCode sends hmac in the Authorization Header of the request
# It is hmac of the webhook id signed by your App Client Secret

SmoothCodeAuth(request_hmac, client_secret).is_webhook_request(webhook_data) # returns True if the request is valid

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

smoothcode_auth-0.0.4.tar.gz (4.3 kB view hashes)

Uploaded Source

Built Distribution

smoothcode_auth-0.0.4-py2.py3-none-any.whl (3.4 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page