environment:
- django (4.0.4)
- rest_framework (3.13.1)
- djangorestframework-simplejwt (5.2.0)
What are the exact settings that should be used with simplejwt+auth0? I cannot find any example and unfortunately i've failed to figure it out by myself.
I have tried the following:
AUTH0_DOMAIN = 'dev-demo-xxxx.auth0.com'
API_IDENTIFIER = 'xxxxx'
PUBLIC_KEY = None
JWT_ISSUER = None
if AUTH0_DOMAIN:
jsonurl = request.urlopen('https://' + AUTH0_DOMAIN + '/.well-known/jwks.json')
jwks = json.loads(jsonurl.read().decode('utf-8'))
cert = '-----BEGIN CERTIFICATE-----\n' + jwks['keys'][0]['x5c'][0] + '\n-----END CERTIFICATE-----'
certificate = load_pem_x509_certificate(cert.encode('utf-8'), default_backend())
PUBLIC_KEY = certificate.public_key()
JWT_ISSUER = 'https://' + AUTH0_DOMAIN + '/'
SIMPLE_JWT = {
'ALGORITHM': 'RS256',
'AUDIENCE': 'https://issuer-domain',
'ISSUER': JWT_ISSUER,
'VERIFYING_KEY': PUBLIC_KEY
}
but tokens that are sent from client (retrieved successfully using auth0 javascript library) are not verified properly on the backend. (token has been successfully verified using jwt.io debugging tool)
current error:
code: "token_not_valid" detail: "Given token not valid for any token type"