Skip to main content

Desktop Typsa SSO helper client for Lambda-based Microsoft auth flows.

Project description

SSO-Package-Pip

Package to integrate a desktop application with an existing Lambda-based SSO flow.

URL contract

This client builds the SSO trigger URL using only:

  • email
  • redirect_uri

Configuration (environment variables)

The library does not call load_dotenv(); your app can load a .env before calling TypsaSSOClient.set_config().

Authorize URL: The package includes the corporate SSO endpoint URL by default (DEFAULT_SSO_AUTHORIZE_URL in sso_typsa.defaults).
It is not mandatory to define SSO_AUTHORIZE_URL unless you want to override it (eg., another environment, staging, etc.).

Variable Required Purpose
SSO_AUTHORIZE_URL or TYPSA_SSO_AUTHORIZE_URL No Overrides the authorization URL embedded in the package
SSO_REDIRECT_URI, TYPSA_SSO_REDIRECT_URI, or SSO_CALLBACK_URL No Local callback URL (default: http://localhost:8765/callback)

See .env.example in this repository for optional overrides.

Example:

from sso_typsa import TypsaSSOClient

client = TypsaSSOClient.set_config()
tokens = client.authenticate_strict(email="user@company.com")

Install (local development)

pip install -e .

Quick start

from sso_typsa import TypsaSSOClient

client = TypsaSSOClient(
    authorize_url="https://your-lambda-domain/sso",
    default_redirect_uri="http://localhost:8765/callback",
)

tokens = client.authenticate(email="user@company.com")

print(tokens.id_token)
print(tokens.refresh_token)

What authenticate(...) does

  • opens the browser to your Lambda SSO URL
  • sends email and redirect_uri as query params
  • waits for redirect callback on localhost
  • returns parsed tokens

Separate desktop app entity

Desktop UI is now kept separate from the package in desktop_app/app.py.

Run from this repository:

pip install -e .
python desktop_app/app.py

This keeps desktop-sso-client as a clean reusable package, while the UI app is a consumer of that package.

Windows custom protocol registration (optional)

If you want browser to redirect directly to installed app, register your scheme in Windows. Example for scheme mydesktopapp:

reg add "HKCU\Software\Classes\mydesktopapp" /ve /d "URL:mydesktopapp Protocol" /f
reg add "HKCU\Software\Classes\mydesktopapp" /v "URL Protocol" /d "" /f
reg add "HKCU\Software\Classes\mydesktopapp\shell\open\command" /ve /d "\"python\" \"C:\path\to\desktop_app\app.py\" --callback-url \"%1\"" /f

After this, a redirect like mydesktopapp://auth/callback?... can open the app.

Web mapping

If web app uses:

const loginUrl = `${environment.ssoUrl}?email=${email}&redirect_uri=${redirectUri}`;
window.location.href = loginUrl;

desktop app equivalent:

tokens = client.authenticate(email="user@company.com")

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

typsa_sso_client-0.2.3.tar.gz (33.3 kB view details)

Uploaded Source

Built Distribution

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

typsa_sso_client-0.2.3-py3-none-any.whl (32.3 kB view details)

Uploaded Python 3

File details

Details for the file typsa_sso_client-0.2.3.tar.gz.

File metadata

  • Download URL: typsa_sso_client-0.2.3.tar.gz
  • Upload date:
  • Size: 33.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for typsa_sso_client-0.2.3.tar.gz
Algorithm Hash digest
SHA256 d1ee061a6a9ff8862675c538758997390354aa65f778a16814d102881ffdb5e4
MD5 fe778083dd1e7a5dda51311b0f2c6f0c
BLAKE2b-256 3b8d0f22469ddb222ab87041b2d5de50151123cc47ff0d4a6f23cf1ca8e0be2d

See more details on using hashes here.

File details

Details for the file typsa_sso_client-0.2.3-py3-none-any.whl.

File metadata

File hashes

Hashes for typsa_sso_client-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 fe751f751518defaf7f9d54ad6fd674c2d1356c0e237b5329bc80b8dc1e8312b
MD5 0ca38da2dcdb9d16de4c48fa23059073
BLAKE2b-256 21f92af8af3d349460e129a2022a7e231af963ea168202fbb878db1330704c8a

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