Skip to main content

Auth service layer (HubSpot token via AWS Secrets + API)

Project description

ofg-auth-service-layer

Auth service layer for fetching HubSpot access tokens. This package retrieves an API token from AWS Secrets Manager and uses it to call an HTTP endpoint that returns a HubSpot access token.

Install

pip install ofg-auth-service-layer

Requirements

  • Python 3.9+
  • AWS credentials configured (env vars, ~/.aws/credentials, IAM role, etc.)
  • An AWS Secrets Manager secret containing JSON with an API_TOKEN field

Quick Start

Example (async):

import asyncio from ofg_auth_service_layer import AuthService

async def main(): token = await AuthService.get_hubspot_access_token(app="crm") print(token)

asyncio.run(main)

API

AuthService.get_hubspot_access_token(app="crm", secret_name="hs-oauth-manager", api_url=..., timeout_seconds=20.0) -> str

Parameters:

  • app: HubSpot app identifier used as a query param (default: "crm")
  • secret_name: AWS Secrets Manager secret name that contains {"API_TOKEN": "..."} (default: "hs-oauth-manager")
  • api_url: Endpoint used to fetch the HubSpot token Default: https://6jp43hzm45.execute-api.ca-central-1.amazonaws.com/prod/get-secret
  • timeout_seconds: HTTP timeout in seconds (default: 20.0)

Returns:

  • token (str): The access token returned by the endpoint (expects JSON {"token": "..."})

AWS Secret Format

The secret string should be JSON, for example:

{ "API_TOKEN": "YOUR_API_TOKEN_VALUE" }

Notes

  • This package uses AWS Secrets Manager (boto3) and makes HTTP requests using httpx.
  • If the endpoint returns a non-2xx response, an AppError is raised.
  • On unexpected failures, an AppError with status code 401 is raised.

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

ofg_auth_service_layer-0.1.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ofg_auth_service_layer-0.1.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file ofg_auth_service_layer-0.1.0.tar.gz.

File metadata

  • Download URL: ofg_auth_service_layer-0.1.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for ofg_auth_service_layer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 be8ef095d954641310b0a089a150ab312391575630ff0a730e9b10ca8936ff5b
MD5 6db204dc49fc65e088f4f7049e8e462f
BLAKE2b-256 b2abc46f19be129cadd671552a6b94713fa66192b205d470d84ad28952328e7c

See more details on using hashes here.

File details

Details for the file ofg_auth_service_layer-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ofg_auth_service_layer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e479a56eca3363b488ddab0b2dd6b997108ffc58195799682e9cb617573b5375
MD5 8419f40e19254128f0b2655a627eeecb
BLAKE2b-256 1bacc5362714d0e18885a3f21b1024e87accdb4d69de9f1d5779f10e88a41e31

See more details on using hashes here.

Supported by

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