Getting Access Token with R Studio

Hi there! Can I check how can I retrieve the onemap api access token using R Studio?

Thanks!

Hi oyhx,

I am inexperienced in R. Will check it out for you!

Regards,
Kai

Hi @oyhx

You may wish to use R package httr via the command
‘###’
install.packages(“httr”)
‘###’

Then you may use the following R script to get the access token
‘###’
library(httr)
url <- “https://developers.onemap.sg/privateapi/auth/post/getToken
body <- list(‘email’ = ‘youremail@onemap.sg’, ‘password’ = “yourpassword”)
res <- POST(url, body = body, verbose())
content(res)
‘###’

Do let me know if you still encounter any issues yea!

Regards
JH

Hi Kaicong and Junhong,

Thanks for the speedy reply :slightly_smiling_face:

The code works!

Cheers!