Reputation: 9621
I am not sure if this was asked before but I have to do a simple play application which uses some data from Google Places API.
I have found that requests like this:
https://maps.googleapis.com/maps/api/place/search/json?location=46.5882,-95.4075&radius=50000&types=lodging&sensor=false&key=[your_api_key]
perfectly works from the browser but not from Play! (it returns REQUEST_DENIED
):
parameters.put("location", cityFound.latitude+","+cityFound.longitude);
parameters.put("radius", "50000");
parameters.put("types", "lodging");
parameters.put("sensor", "true");
parameters.put("key", "GOOGLE_PLACES_KEY");
WSRequest wsRequest = WS.url("https://maps.googleapis.com/maps/api/place/search/json").setParameters(parameters);
After some headache I discovered that in the browser, if I try to do an http
request instead of the above https
it gives REQUEST_DENIED
.
So I suspect that from Play I cannot do this https
request without having an ssl certificate?
Also, isn't it ugly to pay hundreds of $ for a ssl certificate just for something like this (or you know any free solution which is easy to be implemented in Play?)
Upvotes: 0
Views: 597
Reputation: 9621
Issue Solved.
It's unbelievable how the mistakes are happening some times.
parameters.put("key", "GOOGLE_PLACES_KEY");
it should be:
parameters.put("key", GOOGLE_PLACES_KEY);
because it's a constant defined.
Upvotes: 1
Reputation: 6685
You don't have to buy a certificate. You have to make sure that the certificate sent by the server will be accepted by your application.
But more important is to check about any exception or error messages in your applications log. Does your application really falls back to http either you have defined to use https? Did you use the right Google API Key?
Upvotes: 1
Reputation: 1
You probably can export certificate, that googleapis gives to your browser. In Firefox you can do it from Options->Advanced->Encryption->View Certificates.
Upvotes: 0