Skip to content

pkce

#!/usr/bin/python3
import base64
import hashlib
import os

for index in range(1, 10):
    verifier = base64.urlsafe_b64encode(os.urandom(128)).rstrip(b'=').decode("utf-8")
    code_challenge = base64.urlsafe_b64encode(hashlib.sha256(verifier.encode("utf-8")).digest()).rstrip(b'=').decode("utf-8")

    print("-----------------------------")
    print("verifier        : " + verifier)
    print("code_challenge  : " + code_challenge)