Hi everyone! Hadley Wickham suggested some awesome improvements to the code featured in this video. Please use the code on GitHub rather than what's in the video :) Link to the code that should be used: github.com/melissavanbussel/RU-vid-Tutorials/blob/main/httr2/httr2_examples.R The changes are: - Using the req_url_path_append() function rather than pasting things together with the paste0() function - Define the access tokens as system environment variables and access them using Sys.getenv() rather than including the tokens directly in the script (for instructions on how to set your Open AI API key as a system environment variable, check this video here at timestamp 30:34 - ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-tqfOgWr0PAY.htmlsi=GEERk28_m4tyDXab&t=1835) - Using the req_auth_bearer_token() function to greatly simplify working with access tokens
Great work, thank you for sharing this tutorial! I've been wanting to learn more about working with APIs using R. Your explanations and instructions made it easy to follow along. Looking forward to trying it out myself. Keep up the great work!
For future reference, here is the way I figured out how to make code challenges for PKCE! make_challenge % charToRaw() %>% openssl::sha256() %>% openssl::base64_encode() %>% str_replace_all("=", "") %>% str_replace_all("\\+", "-") %>% str_replace_all("/", "_") }