0

I am trying to authenticate to GoogleAuthR running following code

library(googleAnalyticsR)
setwd("C:/work/r_scripts/Analytics")
my_client_id <- "****.apps.googleusercontent.com"
my_client_secret <- "*****-*****"
options(googleAuthR.client_id = my_client_id)
options(googleAuthR.client_secret = my_client_secret)
ga_auth()

then I received a "success code" that popped up in Chrome, saying "please copy this code switch to your application and paste it there". However, I cannot find where to paste it.

Thank you!

Fuse mkt
  • 3
  • 1

1 Answers1

1

The R session should be waiting for you to paste it in when you switch back from your browser - see image below

enter image description here

But also see the googleAnalyticsR website’s setup page as this auth flow can happen automatically if you have library(httpv) installed.

MarkeD
  • 2,500
  • 2
  • 21
  • 35
  • What kind of code is that? I would be glad if you gave any references for a specific code because I can't find "httpv" as you mentioned in docs – Fuse mkt Aug 13 '20 at 11:18
  • See https://code.markedmondson.me/googleAnalyticsR/articles/setup.html#dependencies "If you install httpuv then the authentication flows will occur behind the scenes - this is normally installed by default but if you do not include it you will need to use the more manual OOB method to generate authentication tokens." – MarkeD Aug 13 '20 at 13:47
  • 1
    Thanks a lot! It works. Now I see why ibrary(httpv) did not install - package ‘httpv’ is not available (for R version 3.6.0). Gonna update R Studio – Fuse mkt Aug 13 '20 at 15:45
  • Great, please accept the answer so others may benefit from it as well – MarkeD Aug 14 '20 at 09:34