R Peer certificate cannot be authenticated with given CA certificates, Windows

Malan Kriel picture Malan Kriel · Nov 3, 2016 · Viewed 9.6k times · Source

When trying to import a google sheet using the gs_read() function, I get the following error message:

Error in curl::curl_fetch_memory(url, handle = handle) : Peer certificate cannot be authenticated with given CA certificates

I am following this vignette and get the error when using the code:

oceania <- gap %>%  gs_read(ws = "Oceania")

I have found similar issues for Ubuntu and php, but nothing that has been able to help me.

Does anyone know why I am getting this error and how to fix it?

I am using R 3.3.2 and Windows 7.

Answer

KERO picture KERO · Dec 2, 2016

My colleague had the same issue and I stumbled on this post on R-Bloggers by Andrew Collier. The solution below will fix your problem, but I don't know if it might cause other security issues.

library(httr)
set_config(config(ssl_verifypeer = 0L))

update: This will disable ssl verification. https://github.com/r-lib/httr/issues/262