Using the Twilio official tutorial code here, I get a phone number and a TwiML app running fine, and start both the flask
server and the ngrok
forwarding processes. Operating system and browser are Chrome 53.0.2785.143 (64-bit) on Mac OSX
.
Unfortunately, it fails, giving this error: Twilio.Device Error: JWT signature validation failed
as showing in the screenshot:
I tried handing in {debug : true}
to the call like so:
Twilio.Device.setup(data.token, { debug: true });
and got the following output:
But it's still not clear what's going on. If I try throwing the actual compatibility token returned into Python console (using JWT encoder/decoder)and trying to decode it using the Twilio secret auth token and the HS256 algorithm:
from jose import jwt
token = "xxxxx" # compatibility token from above in browser
print jwt.decode(token, TWILIO_AUTH_TOKEN, algorithms=['HS256'])
I get the following error:
/Users/me/.virtualenvs/myenv/lib/python2.7/site-packages/jose/jwt.pyc in decode(token, key, algorithms, options, audience, issuer, subject, access_token)
132 payload = jws.verify(token, key, algorithms, verify=verify_signature)
133 except JWSError as e:
--> 134 raise JWTError(e)
135
136 # Needed for at_hash verification
JWTError: Signature verification failed.
So maybe they aren't using that as the secret to encode decode, so not sure how much that proves.
Any thoughts?