Stephen-McDaniel / r-google-analytics

This repository is an export of the final version from the retired Google Code system (code.google.com/p/r-google-analytics).
0 stars 0 forks source link

error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed #1

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

When I run this code in R:
library(XML)
library(RCurl)
library(bitops)# 1. Create a new Google Analytics API object 
ga <- RGoogleAnalytics()  
#2. Authorize the object with your Google Analytics Account Credentials 
ga$SetCredentials("username", "password")  

What is the expected output? What do you see instead?

Rather than established connection, I get this ERROR message:
Error in postForm("https://www.google.com/accounts/ClientLogin", Email = 
username,  : 
  SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify 
failed

What version of the product are you using? On what operating system?
Rx64 2.12.0 on Windows 64 bit

Please provide any additional information below.

Original issue reported on code.google.com by Kimberly...@gmail.com on 8 Dec 2010 at 3:32

GoogleCodeExporter commented 8 years ago
Hi,

I'm having the same problem. I'm using R 2.12.0. The window is vista 32 bits.I 
also used the following link to work around. But it didn't help.

http://stackoverflow.com/questions/4391017/using-r-with-google-analytics/4412156
#4412156

Original comment by arijit.i...@gmail.com on 12 Dec 2010 at 8:46

GoogleCodeExporter commented 8 years ago
I'm having the same problem and after spending days of looking for some 
solution, I don't know what to do. I think I have very similar conditions like 
comment #1: Windows Vista 32b, R version 2.12.1.

I see that there exists a Google SSL Certificate file in the RCurl directory:
"c:\Program Files\R\R-2.12.1\library\RCurl\CurlSSL\google.crt" 
and I have even tried to export it once again from Firefox from 
https://www.google.com, but I don't know if I can replace it and if this can 
make this thing work.

I have found the http://curl.haxx.se/docs/sslcerts.html manual, but none of 
those steps seemed relevant to me.

I was looking deeper into RGoogleAnalytics and found the function what 
ga$SetCredentials fires and I see that there is a construction:

auth.resp <- postForm("https://www.google.com/accounts/ClientLogin",
  Email = "...",Passwd = "...",accountType = "GOOGLE",source = "r-google-analytics",service = "analytics")

I though that the way can be to add there
1) ssl.verifypeer = 'FALSE'
or
2) cainfo = "c:/cacert.pem" 

but none of these steps worked for me.

The first step still outputs:
  SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify 
failed
In addition: Warning message:
In testCurlOptionsInFormParameters(.params) :
  Found possible curl options in form parameters: ssl.verifypeer

and the second step outputs the same error, just with the difference that the 
found curl options parameter is cainfo.

It is strange, because the difference between
A) x = getURLContent("https://www.google.com", ssl.verifypeer = FALSE)
B) x = getURLContent("https://www.google.com")

is that the B version triggers the known error (certificate verify failed), 
while the A version does not output anything, so I think it is working OK.

I just don't know how to surpass the postForm function with the ssl.verifypeer 
= FALSE. 

Does any one know how to make RGoogleAnalytics work under Windows?

Thank you!

Here is the sessionInfo() output:

R version 2.12.1 (2010-12-16)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=Czech_Czech Republic.1250  LC_CTYPE=Czech_Czech Republic.1250   
[3] LC_MONETARY=Czech_Czech Republic.1250 LC_NUMERIC=C                         
[5] LC_TIME=Czech_Czech Republic.1250    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] RGoogleAnalytics_1.1 XML_3.2-0.2          RCurl_1.5-0.1       
[4] bitops_1.0-4.1  

Original comment by pavel.ja...@dobryweb.cz on 3 Feb 2011 at 9:23

GoogleCodeExporter commented 8 years ago
RGoogleAnalytics work under Windows.

options(RCurlOptions = list(capath = system.file("CurlSSL", "cacert.pem", 
package = "RCurl"), ssl.verifypeer = FALSE))

Original comment by mthr.ok...@gmail.com on 8 Apr 2011 at 12:26

Attachments:

GoogleCodeExporter commented 8 years ago
RGoogleAnalytics work under Windows+proxyserver with "--internet2" flag.

curl <- getCurlHandle()
options(RCurlOptions = list(capath = system.file("CurlSSL", "cacert.pem", 
package = "RCurl"), ssl.verifypeer = FALSE))
curlSetOpt(.opts = list(proxy = 'proxyserver:port'), curl = curl)

postForm(#####org#####, curl = curl)
getURL(#####org#####, curl = curl)

Original comment by mthr.ok...@gmail.com on 8 Apr 2011 at 12:42

Attachments:

GoogleCodeExporter commented 8 years ago
Thank you, Mitsuhiro! :-)
I knew about the --internet2 flag, but the problem was in Curl SSL options. 

With your options setting I am able to continue and actually I'm getting the 
data I wanted! I just had to comment the rawToChar(auth.resp) function that 
goes right after the postForm call.

Regards,
Pavel

Original comment by pavel.ja...@dobryweb.cz on 11 Apr 2011 at 1:51

GoogleCodeExporter commented 8 years ago
What does it mean to set ssl.verifypeer = FALSE ? Is there any risk associated 
with this?  I am not very familiar with curl but would like to learn, 
specifically to use the RGoogleAnalytics package.

Original comment by Nick.Her...@gmail.com on 16 Feb 2012 at 7:29

GoogleCodeExporter commented 8 years ago
hi Nick!

http://www.omegahat.org/RCurl/FAQ.html
"When I try to interact with a URL via https, I get an error of the form"

regards,

Original comment by mthr.ok...@gmail.com on 16 Feb 2012 at 11:15

GoogleCodeExporter commented 8 years ago

Original comment by michael....@gmail.com on 17 Feb 2013 at 5:48

GoogleCodeExporter commented 8 years ago
Hi, Check this out. Works. 
http://decisionstats.com/2013/02/17/rgoogleanalytics-package-updated-works-for-o
auth-2-0-rstats/
Regards,
Raoul

Original comment by Blu.Oshn...@gmail.com on 30 Jul 2013 at 11:42