I am attempting to access the inoreader API in R using the httr package. So far I am failing because of my limited understanding of how an API request work. I was wondering if anyone could help me to get started, by creating a function to retrieve the OAuth 2.0 bearer token.
This is where I got so far:
library(httr); library(jsonlite)
token <- function(client_id_f, redirect_uri_f) {
POST("/oauth2/token HTTP/1.1",
config=add_headers(
`Host`="www.inoreader.com",
`Content-length`="217",
`Content-type`="application/x-www-form-urlencoded",
`User-agent`="your-user-agent"
),
body = list(client_id=client_id_f,
redirect_uri=redirect_uri_f,
scope='read',
state='guydqwgusadhdashijdsahj')
)-> res
stop_for_status(res)
content(res)
}
And unsurprisingly the response is URL rejected: Malformed input to a URL function. Any help would be appreciated.
I just found an answer I thought it would be worth sharing.