Skip to content

Commit

Permalink
Add copy nav url ref#146
Browse files Browse the repository at this point in the history
  • Loading branch information
chainsawriot committed Nov 26, 2023
1 parent 2f6378d commit 279b5ff
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion R/auth.R
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,14 @@ create_token <- function(client, type = "public", browser = TRUE) {
if (browser) {
httr::BROWSE(url, query = query)
} else {
message(paste("Navigate to", httr::modify_url(url, query = query), "to obtain an authorization code"))
nav_url <- httr::modify_url(url, query = query)
if (clipr::clipr_available()) {
clipr::write_clip(nav_url)
url_copied <- "[copied to clipboard]"
} else {
url_copied <- ""
}
message(paste("Navigate to", nav_url, url_copied, "to obtain an authorization code"))
}
auth_code <- rtoot_ask(prompt = "enter authorization code: ", pass = TRUE, check_rstudio = TRUE, default = "")
auth2 <- httr::POST(httr::modify_url(url = url, path = "oauth/token"), body = list(
Expand Down

0 comments on commit 279b5ff

Please sign in to comment.