我正在尝试使用python / jwt解码id_token
* Trying 192.99.45.211...
* TCP_NODELAY set
* Connected to host_name (192.99.45.211) port 443 (#0)
* schannel: SSL/TLS connection with host_name port 443 (step 1/3)
* schannel: checking server certificate revocation
* schannel: ALPN, offering http/1.1
* schannel: sending initial handshake data: sending 204 bytes...
* schannel: sent initial handshake data: sent 204 bytes
* schannel: SSL/TLS connection with host_name port 443 (step 2/3)
* schannel: failed to receive handshake, need more data
* schannel: SSL/TLS connection with host_name port 443 (step 2/3)
* schannel: encrypted data got 3559
* schannel: encrypted data buffer: offset 3559 length 4096
* schannel: sending next handshake data: sending 214 bytes...
* schannel: SSL/TLS connection with host_name port 443 (step 2/3)
* schannel: failed to receive handshake, SSL/TLS connection failed
* Closing connection 0
* schannel: shutting down SSL/TLS connection with host_name port 443
* Send failure: Connection was reset
* schannel: failed to send close msg: Failed sending data to the peer (bytes written: -1)
* schannel: clear security context handle
curl: (35) schannel: failed to receive handshake, SSL/TLS connection failed
错误是:
import urllib.request
from authlib.jose import jwt
import jwt
from jwt.algorithms import RSAAlgorithm
import json
r='eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImp0aSI6ImFkOWYwNTBmLTY3NWMtNDM1Yi04Yjg4LTQ4YmU2ZTc2ZTM1OCIsImlhdCI6MTU3MjYxNzUzNiwiZXhwIjoxNTcyNjIxMTM2fQ.wCs-4FxR6FPLRpjvbL_zkv_88yvx4PJgRnOo9PVisXs'
url = 'https://dev-297076.oktapreview.com/oauth2/aush9prq3i2F4fAwq0h7/v1/keys'
r = urllib.request.urlopen(url)
str_response = r.read().decode('utf-8')
obj = json.loads(str_response)['keys']
obj2 = json.dumps(str_response)
public_key = RSAAlgorithm.from_jwk(obj)
decoded = jwt.decode(IDjwt, public_key, algorithms='RS256')
非常感谢您的帮助