JestonBlu / RobinHood

An R interface for the RobinHood.com no commision investing site
https://jestonblu.github.io/RobinHood/
GNU Lesser General Public License v3.0
45 stars 12 forks source link

logout() function is returning Internal server error 500 #163

Closed zhangrz2023 closed 1 year ago

zhangrz2023 commented 1 year ago

It seems the api_logout() is referencing the wrong object in the inputted RobinHood object. Request correction.

zhangrz2023 commented 1 year ago

I already have a solution for this, a quick fix and merge is requested.

zhangrz2023 commented 1 year ago

In the code: api_logout <- function(RH) {

detail <- paste("?client_id=", RH$api_request.client_id, "&token=", RH$tokens.refresh_token, sep = "")

url <- paste(RobinHood::api_endpoints("revoke_token"), detail, sep = "")

dta <- httr::POST(url) httr::stop_for_status(dta)

dta <- dta %>% content(type = "json") %>% rawToChar()

return(dta)

}

replace "RH$tokens.refresh_token" with "RH$api_response.refresh_token" should resolve the issue.