Resolved
I am using the following R code to acquire a token from Reddit API on behalf of a user. However, tokens expire in an hour. To keep access with that app, I need to use a refresh_token parameter that I would receive with a first request, I understand. However, for some reason, I cannot receive a refresh_token using the following code:
#API app settings reddit:
endpoint <- oauth_endpoint(
authorize = "https://www.reddit.com/api/v1/authorize",
access = "https://www.reddit.com/api/v1/access_token"
)
appName <- "xxx"
key <- "xxx"
secret <- "xxx"
app <- oauth_app(appName, key, secret)
# authenticate using OAuth2 [an issue with token]
token <- oauth2.0_token(
endpoint = endpoint,
app=app,
scope = c("read"),
user_params = list(duration = "permanent"),
use_basic_auth = TRUE,
config_init = user_agent("Testing"),
cache = TRUE
)
That's how the resulted token looks like:
print(token$credentials)
$access_token
[1] "xxx"
$token_type
[1] "bearer"
$expires_in
[1] 3600
$scope
[1] "read"
Would anybody please suggest how to improve this request?