resfreshToken: Refresh expired OAuth token to access jamendo web API

Description Usage Arguments Value Examples

View source: R/authenticate.R

Description

refreshToken refreshes an OAuth access token that enables R to make authenticated calls to the Jamendo API. The refreshed token can be saved as a file in disk to be re-used in future sessions. This function relies on the httr package to refresh the OAuth token

Usage

1
2
3
4
5
resfreshToken(
  token,
  client_id = Sys.getenv("JAMENDO_CLIENT_ID"),
  client_secret = Sys.getenv("JAMENDO_CLIENT_SECRET")
)

Arguments

token

OAuth access token (the previously created OAuth token)

client_id

Defaults to System Environment variable "JAMENDO_CLIENT_ID"

client_secret

Defaults to System Environment variable "JAMENDO_CLIENT_SECRET"

Value

Returns an OAuth access token as environment

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Example
 app_name = ""
 if(app_name != "") {
  my_oauth <- jamendoOAuth(app_name=app_name)
  filedir <- tempdir()
  save(my_oauth, file=file.path(filedir, "my_oauth"))
  my_oauth <- resfreshToken(my_oauth)
  filedir <- tempdir()
  save(my_oauth, file=file.path(filedir, "my_oauth"))
 }

JamendoR documentation built on Nov. 7, 2021, 5:08 p.m.