Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement refresh for Gargle2.0 #79

jennybc opened this issue May 29, 2019 · 1 comment

Implement refresh for Gargle2.0 #79

jennybc opened this issue May 29, 2019 · 1 comment


Copy link

jennybc commented May 29, 2019

I don't think we can just inherit this from Token2.0 because removing a token from the cache is different for Gargle2.0 tokens. This is also not going to come up very often, i.e. is not urgent, but is worth doing.

relevant excerpt from httr::Token2.0:

  refresh = function() {
    cred <- refresh_oauth2.0(self$endpoint, self$app,
        self$credentials, self$params$user_params, self$params$use_basic_auth)
    if (is.null(cred)) {
      remove_cached_token(self)   # <-- this won't actually un-cache a Gargle2.0 token
    } else {
      self$credentials <- cred
@jennybc jennybc added this to the v0.4.0 milestone Oct 2, 2019
Copy link
Member Author

jennybc commented Oct 3, 2019

This is pretty difficult to fix since Token2.0's $refresh() method calls the unexported and very meaty function httr:::refresh_oauth2.0():

I do not want to re-implement or copy that. The only thing I need to modify in the $refresh() method is the definition of remove_cached_token():

  • To un-cache a Token2.0, you delete its component from the list of tokens that is the cache.
  • To un-cache a Gargle2.0, you delete its file from the cache directory.

@hadley do you have any ideas?

@jennybc jennybc modified the milestones: v0.4.0, future Oct 3, 2019
@jennybc jennybc closed this as completed in 8aa142e Oct 4, 2019
jennybc added a commit that referenced this issue Oct 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

1 participant