小编Luk*_*kas的帖子

DeviceCheck:无法验证授权令牌

我正在尝试让DeviceCheck工作,我不断从Apple的服务器获得这个响应: 401 Unable to verify authorization token.

device_token过的JSON有效载荷base64编码字符串被发送到我的蟒蛇服务器.我有什么想法可能做错了吗?

这是我的代码示例:

def device_check_query(device_token):  
    data = {  
        'device_token': device_token,  
        'transaction_id': str(uuid4()),  
        'timestamp': int(time.time() * 1000),  
    }  
    jw_token = get_jw_token()  
    headers = {'Authorization': 'Bearer ' + jw_token}  
    response = requests.post(QUERY_URL, json=data, headers=headers)  
    return response.content

def get_jw_token():  
    with open(KEY_FILE, 'r') as cert_file:  
        certificate = cert_file.read()  

    jw_token = jwt.encode(  
        {'iss': TEAM_ID}, certificate,  
        algorithm='ES256',  
        headers={'kid': KEY_ID})  

    return jw_token
Run Code Online (Sandbox Code Playgroud)

python authentication ios jwt devicecheck

7
推荐指数
1
解决办法
489
查看次数

标签 统计

authentication ×1

devicecheck ×1

ios ×1

jwt ×1

python ×1