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.
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):
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 thereq_oauth_password()for each request just in case the token had expired and needed to be refreshed.