gaiterjones / amazon-alexa-php-hello-world-example

Amazon Alexa PHP Hello World Example
16 stars 14 forks source link

endpoint validation again #8

Open mrtomnguyen opened 4 years ago

mrtomnguyen commented 4 years ago

recently, I started to use Azure Linux php server vs their Windows version before. Just today, I ran into a nasty issue with the Alexa endpoint validation.

"The skill end-point is not validating the signatures for incoming requests and is accepting requests with an empty signature URL. Please make sure that your signature validation is correct. To reject an invalid request with an invalid signature or certificate, the skill should respond with HTTP status code 400 (Bad Request) in the response."

repeated 4x for:

empty signature URL incorrect certificate URL invalid signature URL no signature URL headers are specified

I did test with the same files on Windows server and the error disappears. So I know the Validation is working. I notice the Linux server was returning 500 code so I updated the failure response from: header('alexa request validation failed : ' .$e->getMessage(), true, 400); to: http_response_code(400);

I check the page and it is now returning header 400 but Alexa still wont pass! I'm banging my head with no more ideas! hope someone can help.