Retrieve a fresh waterinfo token. A token is not required to get started, see Details section for more information.

get_token(client = NULL, client_id = NULL, client_secret = NULL,
  token_url = "")




base64 encoded client containing the client id and client secret, seperated by :


client id string


client secret string


url to get the token from


a token object


An object of class token containing the token string with the token_url, token type and moment of expiration as attributes.


Notice you do not need to get a token right away to download data. For limited and irregular downloads, a token will not be required. The amount of data downloaded from is limited via a credit system. When you require more extended data requests, request a download token.

Either client or client_id and client_secret need to be passed as arguments. If provided, client is always used. Tokens remain valid for 24 hours, after which a fresh one must be acquired. To limit load on the server, token objects should be reused as much as possible until expiration in stead of creating fresh ones for each call.

The client_id and client_secret provided in the examples are for test purposes, get your very own client via [email protected].


# Get token via client_id and client_secret client_id <- '32dceece-826c-4b98-9c2d-b16978f0ca6a' client_secret <- '4ada871a-9528-4b4d-bfd5-b570ce8f4d2d' my_token <- get_token(client_id = client_id,client_secret = client_secret) print(my_token)
#> Token: #> eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiI0YjlhZTQwNS0yMDBkLTQ4ZmYtYjIxYi1hYTYxNDdhZDE0MDMiLCJpYXQiOjE2MDUyMDMxMzUsImlzcyI6Imh0dHA6Ly9sb2NhbGhvc3Q6ODA4MC9LaVdlYlBvcnRhbC9hdXRoIiwiYXVkIjoiMzJkY2VlY2UtODI2Yy00Yjk4LTljMmQtYjE2OTc4ZjBjYTZhIiwiZXhwIjoxNjA1Mjg5NTM1fQ.JI_7_SHbUpCkvPHRwgnJB9ff6vOCb94Cm1rL8XVn2WY #> #> Attributes: #> url: #> type: Bearer #> expires: 2020-11-13 17:45:35 UTC
# get token via client client <- paste0('MzJkY2VlY2UtODI2Yy00Yjk4LTljMmQtYjE2OTc4ZjBjYTZhOjRhZGE4', 'NzFhLTk1MjgtNGI0ZC1iZmQ1LWI1NzBjZThmNGQyZA==') my_token <- get_token(client = client) print(my_token)
#> Token: #> eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJmY2E0OTdjYy1lOGYxLTQwZjAtOWQxZS05ODYyMzVjZmNiMGYiLCJpYXQiOjE2MDUyMDMxMzUsImlzcyI6Imh0dHA6Ly9sb2NhbGhvc3Q6ODA4MC9LaVdlYlBvcnRhbC9hdXRoIiwiYXVkIjoiMzJkY2VlY2UtODI2Yy00Yjk4LTljMmQtYjE2OTc4ZjBjYTZhIiwiZXhwIjoxNjA1Mjg5NTM1fQ.Y-VVyzt7RI7ldAqFAw8Lslk1iNDWsP_ReuDKZwW5T8Y #> #> Attributes: #> url: #> type: Bearer #> expires: 2020-11-13 17:45:35 UTC
#> [1] FALSE
#> Time difference of 24 hours