def METHOD_NAME(item_id):
    state = ''.join(random.choice('0123456789abcdef') for _ in range(32))
    while True:
        code_verifier = ''.join(random.choice('0123456789abcdef') for _ in range(96)).encode('utf-8')
        hashed = sha256(code_verifier).hexdigest()
        code_challenge = codec_encode(codec_decode(hashed, 'hex'), 'base64').decode("utf-8").strip().replace('=', '')
        # make sure that the hashed string doesn't contain + / =
        if not any(c in '+/=' for c in code_challenge):
            result = json.dumps(
                {
                    'code_verifier': code_verifier.decode("utf-8"),
                    "params": {
                        'client_id': item_id,
                        'redirect_uri': URL_AUTH_CALLBACK % item_id,
                        'response_type': 'code',
                        'scope': 'openid profile email',
                        'state': state,
                        'code_challenge': code_challenge,
                        'code_challenge_method': 'S256',
                        'response_mode': 'query',
                        'action': 'undefined'
                    }
                }
            )
            return result