ClaudioZandonella / trackdown

R package for collaborative writing and editing of R Markdown (or Sweave) documents in Google Docs.
https://ClaudioZandonella.github.io/trackdown/
GNU General Public License v3.0
214 stars 15 forks source link

add quick way to use own app #38

Closed maelle closed 1 year ago

maelle commented 1 year ago

Fix #37

As far as I understand, currently trackdown uses credentials that are saved in sysdata.rda.

Still WIP, untested beyond checking what active_trackdown_app() returns, as I haven't created an app in Google Cloud dashboard yet. It's also not necessarily the best way to use one's own app: it'd be nice to have a function as in gmailr https://gmailr.r-lib.org/articles/gmailr.html#external-setup gmailr::gm_auth_configure().

With this fork one would run

my_app_name <- "trackdown-rpackage-fork"
my_app_secret <- "GOCSblablabla"
my_app_key <- "blablablabla.apps.googleusercontent.com"

my_app <- httr::oauth_app(
  appname = my_app_name,
  secret = my_app_secret,
  key = my_app_key
)

options("trackdown-app" = my_app)

Cc @krlmlr

maelle commented 1 year ago

better way = https://gargle.r-lib.org/articles/gargle-auth-in-client-package.html

ClaudioZandonella commented 1 year ago

Hi @maelle

Thank you very much for this PR, it is exactly what we need!❤️

I am reviewing right now all the possibilities to allow access with the user's own credentials. I will merge your pull request after adding the required documentation.

Thank you again for your help

maelle commented 1 year ago

I think my PR is a bit of a hack though, it'd be better not to merge it and to follow the step in https://gargle.r-lib.org/articles/gargle-auth-in-client-package.html#overview-of-mechanics :innocent:

ClaudioZandonella commented 1 year ago

Hi @maelle,

After reviewing the documentation of gargle, gmailr, and googledrive, I think a mix of your approach and the one described in the documentation is the best solution. According to my understanding, here few points to consider [these are actually notes for myself to summarize the problem and avoid forgetting😅]:

I hope the final procedure will not be too complicated for the users and hopefully, in the future, we will succeed in the google verification.

I will update when all changes are ready. Thanks again for your help❤️

ClaudioZandonella commented 1 year ago

hi @maelle

I just released a new version of trakdown that allow using custom app credentials. Unfortunately, it is necessary that users create their own app. I added a detailed guide here https://claudiozandonella.github.io/trackdown/articles/oauth-app-configuration.html

Let me know if it is now usable or if more details are needed (there is no such a thing as too much documentation 😅)

Hopefully, in the future, we will be able to pass google authentication process

I do not why you do not appear as a contributor as well. I changed dramatically the code, but there is still your commit. I will fix it tomorrow.

Thanks again for your suggestions❤️

maelle commented 1 year ago

wow I see you made a ton of progress on this, awesome to see! Thank you!!