r - RGA (CRAN) - "get_accounts" gives wrong accounts -


note says: rga package cran. different "rga" package github. nevertheless, have same problem both packages. question let's stick rga cran.

**the questions updated , edited, because first aid not enough. still have problems accounts.

i work 2 emails accesing google analtics. each 1 has access diffent accounts within google analytics. use email @ house, , email b @ work.

now, im using rga (from cran) within r, , @ house need access google analytics accounts email b (work email, has access specific google analytics accounts).

the problem when using code:

for account 1: email (home email):

client.id1 <- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"  client.secret1 <- "bbbbbbbbbbbbbb"   ga_token1 <- authorize(client.id1, client.secret1, cache = true, verbose =    getoption("rga.verbose", false))  get_accounts(start.index = null, max.results = null, ga_token1, verbose = getoption("rga.verbose", false)) 

for account 2: email b (work email):

client.id2 <- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"  client.secret2 <- "yyyyyyyyyyyyyyy"   ga_token2 <- authorize(client.id2, client.secret2, cache = true, verbose =   getoption("rga.verbose", false))   get_accounts(start.index = null, max.results = null, ga_token2, verbose =    getoption("rga.verbose", false)) 

what ever, use @ home computer, same accounts fro both home gmail accounts ga, , work gmail account ga.

is there step i'm missing?

i want accounts email b, no matter accounts related email a.

i've delated google analytics api projects (from , b), , recreated api email b. no matter what, accounts email a.

**my google api project created b (the email access desire account). see accounts related a.

it appears because tokens stored in same cache file (.ga-token.rds default), i.e. second token replaced first. when tokens used read cache file.

to solve issue should set cache = false or define specific cache path each token. examples below:

first, disabling cache:

work_token <- authorize(client.id1, client.secret1, cache = false) home_token <- authorize(client.id2, client.secret2, cache = false) 

second, different cache paths:

work_token <- authorize(client.id1, client.secret1, cache = "work.token") home_token <- authorize(client.id2, client.secret2, cache = "home.token") 

to check it:

list_profiles(token = work_token) list_profiles(token = home_token) 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -