Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signature validation faild. #48

Closed
rungsoso opened this issue Aug 14, 2020 · 0 comments
Closed

Signature validation faild. #48

rungsoso opened this issue Aug 14, 2020 · 0 comments

Comments

@rungsoso
Copy link

rungsoso commented Aug 14, 2020

Verify signature has faild

if (request == null) { throw new ArgumentNullException(nameof(request)); }
if (channelSecret == null) { throw new ArgumentNullException(nameof(channelSecret)); }

            var content = await request.Content.ReadAsStringAsync();

            var xLineSignature = request.Headers.GetValues("X-Line-Signature").FirstOrDefault();
            if (string.IsNullOrEmpty(xLineSignature) || !**VerifySignature(channelSecret, xLineSignature, content)**)
            {
                **throw new InvalidSignatureException("Signature validation faild.");**
            }

            dynamic json = JsonConvert.DeserializeObject(content);

            if (!string.IsNullOrEmpty(botUserId))
            {
                if (botUserId != (string)json.destination)
                {
                    throw new UserIdMismatchException("Bot user ID does not match.");
                }
            }
            return WebhookEventParser.ParseEvents(json.events);
@rungsoso rungsoso changed the title 500 Internal Server Error Signature validation faild. Aug 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant