How to get R to accept self signed certificates

2019-08-27 03:28发布

问题:

I have the following code using the Package RGoogleAnaytics

require(RGoogleAnalytics)
client.id <- "XX"
client.secret <- "YY"
token <- Auth(client.id,client.secret)
save(token,file="./token_file")

When running this it goes into my browser and asks me to login to my account which has the Google Analytics profiles i wish to access. Once this has been done R prompts me to return to R and proceed However in R I get the error:

SSL certificate problem: self signed certificate in certificate chain

How can I rectify this? Is there a way to force R to accept such certificates? Is there a way to change the type of certificate that the page gives me?

回答1:

Found this quick fix

set_config( config( ssl.verifypeer = 0L ) )

disables certificate verification and hence allows me to proceed.



回答2:

The former solution doesn't work for me with the latest version of devtools. To solve the problem change the . for a _

set_config( config( ssl_verifypeer = 0L ) )

I beleive the reason is the the new version of of the package devtools changed from RCurl to curl (or viceversa).



标签: r ssl