shield-checkValidate Partner Signature

Verify HMAC-SHA256 signatures from SSO partners to authenticate incoming IdP-Initiated SSO requests.

circle-info

When to use: On every SSO endpoint that receives partner-signed requests. This validates the partner's identity and ensures the payload hasn't been tampered with.

chevron-rightPrerequisiteshashtag

5-Line Core

result = await provider.validate_partner_signature(
    consumer_key="ck_live_a1b2c3d4...",
    signature=request_signature,
    payload=request_body,
    timestamp=request_timestamp,
    email="alice@acme.com",  # Optional: validates against partner's allowed_email_domains
)
partner = result.unwrap()  # SSOPartner on success

Signature Format

Partners compute signatures using:

Component
Description

consumer_secret

The partner's secret (from registration)

timestamp

ISO 8601 timestamp (e.g., 2026-03-12T10:00:00Z)

consumer_key

The partner's public consumer key

payload

The request body being signed

| (pipe)

Separator between components

Step-by-Step

1

Extract Signature Components from Request

2

Validate the Signature

3

Handle the Result

4

Expected Output

circle-check

Generating a Signature (Partner Side)

Partners compute the HMAC-SHA256 signature like this:

Looking Up a Partner

Use get_partner_by_consumer_key when you need partner details without signature validation:

Complete Example

Create validate_partner_signature.py:

Run it:

Expected output:

FastAPI Integration

Common Pitfalls

Pitfall
Solution

Signature always invalid

Ensure signing string format: timestamp|key|payload

Timestamp rejected

Use ISO 8601 format, check tolerance_seconds

Wrong error handling

Check result.error.code for specific error codes

Email domain rejected

Check partner's allowed_email_domains configuration (case-insensitive)

Email check unexpected

email param is opt-in — omit it to skip domain check


circle-info

Found an issue on this page? Report it on our feedback formarrow-up-right.

Last updated

Was this helpful?