Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oauth with Plumber API in R

Tags:

r

api

plumber

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?

like image 493
Rana Usman Avatar asked Apr 19 '18 08:04

Rana Usman


1 Answers

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.

like image 110
Jeff Allen Avatar answered Oct 15 '22 03:10

Jeff Allen