woob.tools.pkce

Utilities for handling PKCE (RFC 7636).

class PKCEChallengeType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: str, Enum

PKCE challenge type.

PLAIN = 'PLAIN'

Plaintext challenge.

S256 = 'S256'

SHA-256 challenge.

class PKCEData(verifier: str, challenge: str, method: str)[source]

Bases: NamedTuple

PKCE data to generate.

verifier: str

The verifier to transmit at token call.

challenge: str

The challenge to transmit in the authorization URL.

method: str

The method to transmit in the authorization URL.

classmethod build(type_=PKCEChallengeType.S256)[source]

Build random data for OAuth2 PKCE extension.

Parameters:

type_ (PKCEChallengeType) – The type of challenge to produce. (default: PKCEChallengeType.S256)

Return type:

PKCEData

Returns:

The PKCE data.