namc-utah / NAMCr

NAMC Database and Analysis R API
MIT License
0 stars 0 forks source link

Not getting prompted when the token has expired #1

Closed philipbaileynar closed 3 years ago

philipbaileynar commented 3 years ago

@David-Fowler I just went into R Studio and tried to run a query again by typing the following:

NAMCr::query("boxStates")

It's been over a day since I ran any queries, so I expected to get prompted for my credentials again but instead I got:

Screen Shot 2021-02-17 at 8 39 17 PM

I get this response regardless of the query I run.

How do I nudge R to prompt me for my credentials again so I get a fresh token?

David-Fowler commented 3 years ago

Yep. That is already fixed in the next update. Originally I had the auto-refresh process in place but inadvertently broke it when I added a pre-configuration check...

philipbaileynar commented 3 years ago

That's great! Can you push the change please so that I can refresh the package in my project. I am currently unable to get the login screen and therefore unable to check API calls from R.

Thanks @David-Fowler !!

David-Fowler commented 3 years ago

I just came back here and found a message I never sent detailing the function to hit to reset the token...

Anyway, here we are now. I just pushed the new version and with it I changed the default credential cache directory to no longer be in the R session working directory. This means you will need to re-login. You will find that after this login you will not have to login again in the future unless you call NAMCr::reinitiate(clear_credentials = TRUE) manually (you only have to now because I moved the cache dir); this all works via the normal access / refresh tokens received during the initial authentication. While the access token has a 1 hour timeout the refresh token I believe is either 6 months or a year.

philipbaileynar commented 3 years ago

That worked! Thank you.