Re: [web2py] Re: How to verify woocommerce webhook signature in web2py auth decorator

2018-03-25 Thread Manuele Pesenti
Il 25/03/18 00:51, Patrick Rodrigues ha scritto: > I was developing the same feature for my website today, and this help > me a lot. > In my case I was using Dango Rest Framework, and I was using > request.data and parsing it to JSON, insted of using request.body. > But now it works, thank you

Re: [web2py] Re: How to verify woocommerce webhook signature in web2py auth decorator

2018-03-17 Thread Manuele Pesenti
Il 16/03/18 15:59, Anthony ha scritto: > I'm not sure if it includes the entire original HTTP message or just > the request body, but you can try request.env['wsgi.input']. If that > doesn't work, web2py (and probably any WSGI-compliant framework) would > not have access to the original HTTP

Re: [web2py] Re: How to verify woocommerce webhook signature in web2py auth decorator

2018-03-16 Thread Anthony
> > Before to definitely fly to other places where to find answers to my > problem I have one little question related with web2py... > In woocommerce documentation they say this about request signature: > > "X-WC-Webhook-Signature - a base64 encoded HMAC-SHA256 hash of the > payload."[1] > >

Re: [web2py] Re: How to verify woocommerce webhook signature in web2py auth decorator

2018-03-16 Thread Manuele Pesenti
On 15/03/2018 22:17, Manuele Pesenti wrote: You might be better off getting help from folks who know WooCommerce, as this issue does not appear to be web2py specific. Yes for sure! Thanks a lot.     M. Before to definitely fly to other places where to find answers to my problem I have one

Re: [web2py] Re: How to verify woocommerce webhook signature in web2py auth decorator

2018-03-15 Thread Manuele Pesenti
Il 15/03/18 20:21, Anthony ha scritto: > Hard to say what's wrong. Where did you get that signature and request > body? You might be better off getting help from folks who know > WooCommerce, as this issue does not appear to be web2py specific. > Yes for sure! Thanks a lot.     M. -- Resources:

Re: [web2py] Re: How to verify woocommerce webhook signature in web2py auth decorator

2018-03-15 Thread Anthony
Hard to say what's wrong. Where did you get that signature and request body? You might be better off getting help from folks who know WooCommerce, as this issue does not appear to be web2py specific. Anthony On Thursday, March 15, 2018 at 1:09:31 PM UTC-4, Manuele wrote: > > On 01/03/2018

Re: [web2py] Re: How to verify woocommerce webhook signature in web2py auth decorator

2018-03-15 Thread Manuele Pesenti
On 01/03/2018 00:50, Anthony wrote: I think you're on the right track. If you need the original request body to verify the signature, request.body.read() should do it. Does that not work? Hi Anthony, actually no :( it doesn't work, here[1] I tried to extrapolate the very essential code in

Re: [web2py] Re: How to verify woocommerce webhook signature in web2py auth decorator

2018-03-01 Thread Anthony
> > On Wednesday, February 28, 2018 at 3:50:16 PM UTC-8, Anthony wrote: >> >> I think you're on the right track. If you need the original request body >> to verify the signature, request.body.read() should do it. Does that not >> work? >> >> Also, I don't think you need the decorator and nested

Re: [web2py] Re: How to verify woocommerce webhook signature in web2py auth decorator

2018-03-01 Thread Manuele Pesenti
On 01/03/2018 03:25, Dave S wrote: Don't you want a dummy parameter on verify_signature(), to prevent it being a URL-visible function? well actually it can even stay inside the models not a controller... in that case if it's not decorate as a service it cannot be visible. right?       

Re: [web2py] Re: How to verify woocommerce webhook signature in web2py auth decorator

2018-02-28 Thread Dave S
On Wednesday, February 28, 2018 at 3:50:16 PM UTC-8, Anthony wrote: > > I think you're on the right track. If you need the original request body > to verify the signature, request.body.read() should do it. Does that not > work? > > Also, I don't think you need the decorator and nested

Re: [web2py] Re: How to verify woocommerce webhook signature in web2py auth decorator

2018-02-28 Thread Anthony
I think you're on the right track. If you need the original request body to verify the signature, request.body.read() should do it. Does that not work? Also, I don't think you need the decorator and nested function. Just write a simple function and call it at the beginning of the handler: def

Re: [web2py] Re: How to verify woocommerce webhook signature in web2py auth decorator

2018-02-28 Thread Manuele Pesenti
Il 28/02/18 17:10, Anthony ha scritto: > You could parse the request body yourself, but web2py will do it > automatically and put the variables in request.post_vars (if JSON is > posted, its keys will become the keys of request.post_vars). > > I'm not sure what you mean by "check the

Re: [web2py] Re: How to verify woocommerce webhook signature in web2py auth decorator

2018-02-28 Thread Anthony
> > > It looks like WooCommerce makes a POST request, so the values posted > > should end up in request.post_vars. > > maybe I don't understand... what I think I need to check is the raw body > of the request... isn't it? How should I check the request.post_vars? > Isn't it a dictionary or a

Re: [web2py] Re: How to verify woocommerce webhook signature in web2py auth decorator

2018-02-28 Thread Manuele Pesenti
Thank Antony, On 28/02/2018 15:50, Anthony wrote: The webhook request headers will be in request.env.http_x_wc_webhook_[specific header] (e.g., request.env.http_x_wc_webhook_signature). ok got it! It looks like WooCommerce makes a POST request, so the values posted should end up in