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

RequestValidator returns false, even when the strings both match #133

Closed
jacobwarren opened this issue Feb 5, 2020 · 2 comments
Closed

Comments

@jacobwarren
Copy link

Below is my code to validate incoming SMS requests.

At first I thought it was user error on my part, but after checking the stack trace, the strings that RequestValidator are comparing to each other are the exact same. Yet it still returns false.

Is this a known issue with RequestValidator, or am I doing something wrong?

defmodule GrowgladWeb.Hooks.MessagesController do
  use GrowgladWeb, :controller

  def receive(conn, params) do
    url = "https://api.growglad.com/hooks/messages/receive"
 
    token = Application.get_env(:ex_twilio, :auth_token)
    signature = List.to_string(get_req_header(conn, "x-twilio-signature"))

    if ExTwilio.RequestValidator.valid?(url, params, signature, token) do
      IO.inspect("The text is valid!")
      Honeydew.async({:receive_sms, [params]}, :queue)
    else
      IO.inspect("The text is invalid!")
    end
  end
end

Ps. Big fan of your learnelixir.tv and learnphoenix.tv websites! That's how I learned/am learning!

@danielberkompas
Copy link
Owner

@jacobwarren this is not a known issue with RequestValidator as far as I am aware. I am adding this to my calendar to look into in the next few days. In the meantime, did you discover anything new since you posted this that might help?

@danielberkompas
Copy link
Owner

I'm closing this down for now. Feel free to reopen if you encounter this in the future.

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

2 participants