Skip to content

req_oauth_password requests passwords regardless of cached token #119

@jl5000

Description

@jl5000

After reading the documentation, I understand that the various OAuth flows are supposed to get a token and cache it so that a user doesn't have to keep authorizing themselves. I have some code which looks similar to this (I've copied and pasted from the vignette and changed a bit for illustrative purposes):

request("https://api.github.com/user") %>% 
  req_oauth_password(client, username = "user", cache_disk = TRUE) %>% 
  req_perform() %>% 
  resp_body_json()

If I then perform another request by using the same code above but changing the url in the request call, it requests my password again, even though a token has already been stored. Based on what I've read in the docs, I expected the req_oauth_password() call to check for a cached token before asking for my password again. Am I misreading the docs or fundamentally misunderstanding how these functions are supposed to be used? I would have imagined I would need to keep calling the req_oauth_password() for each request just in case the token had expired and needed to be refreshed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavioroauth 🔒reprexneeds a minimal reproducible example

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions