InvalidSignatureError exception raised
See original GitHub issueHi, I’m trying to run simple bot echo script. However the bot didn’t received my message and it simply returning InvalidSignatureError. Here is the debug:
[2017-02-16 22:55:13,415] ERROR in app: Exception on /callback [POST] Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app response = self.full_dispatch_request()
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request rv = self.handle_user_exception(e)
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request rv = self.dispatch_request()
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args)
File "bot.py", line 60, in callback print parser.parse(body, signature)
File "/usr/local/lib/python2.7/site-packages/linebot/webhook.py", line 124, in parse 'Invalid signature. signature=' + signature)
InvalidSignatureError: <InvalidSignatureError [Invalid signature. signature=Tt4HKTuQmW/Fzg+y35GEazfK7t9au90BUBwo6+9DCHU=]>
I suspect that it related to the signature check mechanism because I ran the script in local tunneled via ngrok.io. Is that really the problem?
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (3 by maintainers)
Top GitHub Comments
Thanks for sharing! I understood you are using the example code
flask-echo/app.py
.One more thing to check - could your body from webhook request fetch correctly? Our validation method is to compare sigunature from request header with request body.
Examples of body from webhook request is here. Please check the body failed to validate has similar format as following link’s json.
https://devdocs.line.me/en/#webhooks
If you want to validate signature manually, this code will help you. https://github.com/line/line-bot-sdk-python/blob/master/linebot/webhook.py#L70-L101 Validation spec: https://devdocs.line.me/en/#signature-validation
same issue with same code.