kevin-m-kent / youtubeR

https://kevin-m-kent.github.io/youtubeR/
Other
2 stars 1 forks source link

Best of Both Worlds #16

Closed jonthegeek closed 1 year ago

jonthegeek commented 1 year ago

You... weren't wrong about how to implement auth, now that I've dug deep into the bowels of httr2. In theory it would be better to use httr2::req_oauth_auth_code, which re-requests the data if it isn't available in a cache. EXCEPT they don't have a simple way built in to auto-switch that to use environment variables when they're available, and that's what we need to make this work smoothly on GHA.

I'm somewhat surprised this isn't built into httr2, but I'm PRETTY sure it isn't.

The general plan (and some general principles):

I'll need an hour or so to work that out, but I think I grok the essentials. This will allow us to set things up to run fully automatically, even on GHA, as long as we occasionally manually refresh the refresh_token (although they don't seem to actually expire, unless the user revokes them).

jonthegeek commented 1 year ago

Note: I think we might be able to stack some of these things up, and then httr2 will do the fall-backs automatically. I'll experiment with that when I get back to this.

jonthegeek commented 1 year ago

Fixed in #2.