I have created a sample function using plumber
package.
#* @get /tags
printmyname <- function(x) print(x)
When I run the following procedure.
library(plumber)
r <- plumb("plumber_Usman2.R")
r$run(host="0.0.0.0",port=8000)
An API is exposed on my local host which I can access using the host of my R server
.
Something like
http://host:8000/tags?x="This design looks bad, please fix it"
My Question is, since the API is open and can be openly access by anyone with the link, I want to secure it using Oauth. I have been doing research but couldn't come across anything. I would be thankful if someone can guide me in this regards with either plumber
or any other package which can secure my API.
Is it possible?
Please see https://www.rplumber.io/docs/hosting.html. The only option that supports OAuth out-of-the-box is RStudio Connect. You could also consider trying to use the Docker approach and fronting the service with nginx or Apache which may be able to handle the authentication, but it's a bit involved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With