get_signing_key_from_jwt throws error Unable to find a signing key that matches kid

325 Views Asked by At

I'm seeing this error when getting the signing key:

PyJWKClientError: Unable to find a signing key that matches: "{kid}"

The signing_key is where I'm seeing the error:

import jwt

jwks_uri="https://my_auth_server/oauth2/v1/keys"
jwks_client = jwt.PyJWKClient(jwks_uri)

signing_key = jwks_client.get_signing_key_from_jwt(token['access_token'])

I'm getting the token like this:

tdata = {
            'grant_type': 'authorization_code',
            'redirect_uri': config['redirect_uri'],
            'client_id': config['client_id'],
            'client_secret': config['client_secret'],
            'scope': 'openid',
            'state': state,
            'code': code,
        }
         ret = requests.post(config["token_endpoint"], headers=theaders, data=urlencode(tdata).encode("utf-8"))
0

There are 0 best solutions below