New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use httpuv for oauth_listener #32

hadley opened this Issue May 13, 2013 · 2 comments


None yet
1 participant

hadley commented May 13, 2013

Currently, oauth_listener uses the built in httpd server which has the limitation that if help has already been started you can not change the port. Switching to httpuv would remedy this (and the blocking nature of httpuv might actually be an advantage). It should be a simple switch given that httpuv supports Rook.


This comment has been minimized.


hadley commented May 13, 2013

Code might look something like:

info <- NULL
listen <- function(env) {
  info <<- req$params()

  res <- Response$new()
  res$header("Content-type", "text/plain")
  res$write("Authentication complete - you can now close this page and ")
  res$write("return to R.")

message("Waiting for authentication in browser...")

server <- startServer("", port, list(call = listen))
tryCatch(service(2000), finally = stopServer(server))

if (is.null(info)) {
  stop("Server failed to respond in 2 seconds", call. = FALSE)
message("Authentication complete.")

This comment has been minimized.


hadley commented May 13, 2013

Actually that will only catch one event, so need to do:

while(is.null(info)) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment