Enable WooCommerce on http - php

Iam working cart apllication. I installed WooCommerce plugin and generated keys in http server. But it is not returning any products data. Is WooCommerce works in HTTP or it works only in https?

The API works on both http and https protocols. For http you'll have to encode your requests and for https since its already encoded, you just pass the key and secret as parameters. Its best if you first test the response in POSTMAN. I'm attaching screenshot of a successful get response on HTTP.
As you see, you need a Signature method, timestamp and nonce. Every server side language will have different implementations. So read the documentation and try out the examples.
Its a lot simpler for https, and I highly recommend installing an SSL certificate before going into production.

Related

Android-server - Send password securely

I'm publishing my first android app and I have doubts about security with the server.
I followed the tutorial to add security in the HTTP header using sha1, everything went well.
Tutorial
The problem is that the server has to know the password of the user, the client has to send it securely.
Do I have to configure the server with https for the first time the password is sent? should I always use https and forget about http headers?
Is there another secure alternative to https for secure password sending?
I am confused in these basic concepts ....
I need to introduce some security so that the url can not be used by others. It is not a user password, it is a unique string that I send to compare on the server and discard or accept future requests.
Thank you.
Do always use HTTPS: Narf
1 - add https to server (ubuntu 14.04, e2c Amazon), with a new unsigned certificate
https://www.digitalocean.com/community/tutorials/how-to-create-a-ssl-certificate-on-apache-for-ubuntu-14-04
2 - Connect to server from android whit unsigned certificate
https://developer.android.com/training/articles/security-ssl.html#SelfSigned
And resolve the authorization error:
OkHttp trusting certificate
The example of Google is fine, but an image is downloaded and we are interested in making a request, I have done so:
How to do an HTTPS POST from Android?
To add parameters to the request:
How to add parameters to HttpURLConnection using POST
Works for me

How to protect the route from curl in Express Node js?

I have a route, for example /data, which brings data from php to nodejs using curl, but this route is also available from the client side, so I want to allow to use this route only for curl request. How do I can implement it ?
You can't, as HTTP is an open protocol and all client can be simulated.
However, a simple credential can be used to protect the resource, such as /data?password=u8iK9oC -- unless the password is correct, no /data resource would be returned to client. If only curl client know this password, the requirement is implemented.
Use an authentication or IP whitelist. Because any data in the request can be modificated.

Is HTTPS protocol relevant for REST API Webservices?

I have a HTTP REST API in PHP used by an iPhone application.
Some webservices from this API are secured with a user authentication in the HTTP request credentials but I want to avoid "man in the middle" attacks by providing fully encrypted requests data.
I'm not really skilled in security issues and I couldn't find any clear answer to my question anywhere :
Is HTTPS relevant for STATELESS REST API ?
From what I understood, HTTPS does 2 things :
encrypt your session
prove to the client that the server he is talking to is secured
So at first sight it does not respond to my need which is to encrypt the data between my server and the application because the API does not use sessions. But I still have doubts.
Can someone make it clear to me ?
My other solution would by to encrypt requests data with public/private keys system. Would it be more suitable ?
Thank you !
Yes, it is. HTTPS has nothing to do with the application, it's a tunneling protocol. Even though TLS is itself a stateful protocol, the HTTP part going over it is not.
Just like if you were using a VPN, you can still have a REST based application. The TLS just sets up and tears down the tunnel automatically for each connection.
That said, there's value in leveraging the pipelining aspects of HTTP and HTTPS to improve throughput over TLS connections, but that's a performance tuning aspect unrelated to the application itself.
HTTPS is very relevant, and yes, that's because of the two points you mentioned. Did you know that OAuth 2 actually enforces HTTPS?
Doing all the encryption yourself could be an option as well, but you lose the part where the API is easy to use.
Most man-in-the-middle attacks on "simple" HTTP requests involve stealing credentials and faking requests, but they can also read the data sent and received. If your issue is with the data being unreadable, use HTTPS. If fake requests are the only problem, an authentication protocol such as OAuth 1 (not 2) would suffice.
If you do not want to implement SSL you may want to check out http://www.jcryption.org/ I don't know if it will work in a stateless environment, but may be worth a try. It is basically a jquery plugin that handles creating key pair associations for data being transmitted. May only be for form submission though. We used to use it to encrypt login credentials at my old company.
Definitely use, HTTPS if the data is sensitive - it encrypts at the transport layer which is what you are looking for. As already pointed out oAuth 2.0 mandates it essentially. You can potentially avoid man in the middle by using hashing/signing as in oAuth 1.0 and avoid having to use SSL but the body still goes in the clear then (you've avoided sending the API credentials in the clear but not the body).

Google Places API without HTTPS

I am having problems sending requests to the Google Places API because my machine is behind a proxy with authentification. I successfully worked around this in the past by using a context when sending http requests from PHP. I have trouble getting this to work with HTTPS from Google places and the easiest way would be to just use HTTP.
I cannot find the link for the HTTP API. The basic URL for requests is:
https://maps.googleapis.com/maps/api/place/search/output?parameters
(source: http://code.google.com/apis/maps/documentation/places/).
I am looking for a way to connect to this API without using https. Just using http://maps.googleapis.com/maps/api/place/search/output?parameters results in a 404.
Thanks,
David
You should write 'json' or 'xml' instead of 'output' in url.
like http://maps.googleapis.com/maps/api/place/search/json?..

how can I redirect to https which require certain sertificate for access

There's a payment server. I can successfully send data via cURL and set appropriate key and certificate and payment server successfully answers. But now I need to make a redirect to that server so that client can enter credit card data. How can I make that redirect?
Is there a possibility to add key/certificate as a part of headers in function header("Location: https://...."); ?
Even if you could send the certificate along with the redirect, the browser still has to verify it. But you can't. It's impossible. You have to send a regular redirect. Because it's a https address, the browser will first request the certificate from the target host and verify it (including necessary user intervention). The outcome is the same.
There is no way to circumvent the popup dialog requesting the user to accept/trust or deny the certificate. HTTPS is designed to ensure "reasonable protection from eavesdroppers and man-in-the-middle attacks, provided that adequate cipher suites are used and that the server certificate is verified and trusted." (Quote from Wikipedia)
Unless the provider has a very weird setup, I don't think you can. There are two clients cpnnecting to the server - first your PHP code which is using the client certificate, then you expect a browser somewhere to be able to bind to the same session without the client certificate? The only way this would make any sense is if the payment provider sends back a surrogate authentication token - and if they did that they'd provide detailled documentation. Obviously that is not the case.
While you could proxy the data on your server, I'd strongly recommend you switch to a different payment provider which handles the entire payment process for you.

Categories