less_verifies_alexa v0.1.0 LessVerifiesAlexa.Plug
LessVerifiesAlexa.Plug
is a plug that validates requests that
Amazon’s Alexa service sends.
Add the plug to your router like this:
plug LessVerifiesAlexa.Plug, application_id: "your_app_id"
In order for the plug to work, there’s an additional change you have to make.
In your endpoint.ex
, you have to change your Parsers plug to use a custom
JSON parser that this plug provides.
Just change :json
to :alexajson
and you should end up with something
like this:
plug Plug.Parsers,
parsers: [:alexajson, :urlencoded, :multipart],
pass: ["*/*"],
json_decoder: Poison
You have to do this due to a Plug implementation detail we won’t go into here. Hopefully, we’ll soon be submitting a PR to plug itself that should remove the need for this custom adapter.