Skip to main content

Module tokens

Module tokens 

Source

Constantsยง

ACCESS_TOKEN_LENGTH ๐Ÿ”’
USER_CODE_ALPHABET ๐Ÿ”’
Crockford base32 alphabet (excludes I, L, O, U to avoid ambiguity with 1/0).
USER_CODE_GROUP_LEN ๐Ÿ”’
Number of characters in each dash-separated group of a user code.

Functionsยง

generate_access_token
Generate a cryptographically strong opaque token suitable for access/refresh/auth codes.
generate_user_code
Generate a human-typable user_code for the OAuth 2.0 Device Authorization Grant (RFC 8628).
token_digest_sha256
Produce a Digest (HMAC-SHA-256) from an access/refresh token plaintext using a secret key.