question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

InvalidSignatureError exception raised

See original GitHub issue

Hi, 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:closed
  • Created 7 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
okdtskcommented, Feb 20, 2017

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

0reactions
rainmaker712commented, Nov 17, 2022

same issue with same code.

Read more comments on GitHub >

github_iconTop Results From Across the Web

API Reference — PyJWT 2.6.0 documentation - Read the Docs
class jwt.exceptions. InvalidSignatureError ¶. Raised when a token's signature doesn't match the one provided as part of the token. class jwt.exceptions.
Read more >
PyJWT raises Signature verification failed - Stack Overflow
jwt.decode(..) expects the key value to be the actual secret in a text string, no encoding. It appears that your token was encoded...
Read more >
Exceptions | Node.js - Braintree Developer Documentation
Invalid Signature. braintree.exceptions.InvalidSignatureError. Raised when the webhook notification you attempt to parse has an invalid signature.
Read more >
Python jwt.ExpiredSignatureError() Examples
InvalidTokenError: raise exceptions.AuthenticationFailed() self. ... InvalidSignatureError): return None else: return payload. Example #5 ...
Read more >
api_jws.py · aroundthecode/PyJWT - Gemfury
... text_type from .exceptions import ( DecodeError, InvalidAlgorithmError, InvalidSignatureError, InvalidTokenError ) from .utils import base64url_decode, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found