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.eyJqdGkiOiJhYzE0NjZiOS1mN2FkLTRmYzEtYTM3ZC1iZGVjZmNjMGU3MTAiLCJpYXQiOjE2MjUxNjE1MzEsImlzcyI6Imh0dHA6Ly9sb2NhbGhvc3Q6ODA4MC9LaVdlYlBvcnRhbC9hdXRoIiwiYXVkIjoiMzJkY2VlY2UtODI2Yy00Yjk4LTljMmQtYjE2OTc4ZjBjYTZhIiwiZXhwIjoxNjI1MjQ3OTMxfQ.Gh4AKvMVYrTR-oweA-lsVE9O0vFqldW73HUZdDV2Ybs #> #> Attributes: #> url: #> type: Bearer #> expires: 2021-07-02 17:45:31 UTC
# get token via client client <- paste0('MzJkY2VlY2UtODI2Yy00Yjk4LTljMmQtYjE2OTc4ZjBjYTZhOjRhZGE4', 'NzFhLTk1MjgtNGI0ZC1iZmQ1LWI1NzBjZThmNGQyZA==') my_token <- get_token(client = client) print(my_token)
#> Token: #> eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJhZmI0ZjA5NS1kNzU3LTQ2NjgtOWY4NC05NWViNTRiY2MwMDgiLCJpYXQiOjE2MjUxNjE1MzEsImlzcyI6Imh0dHA6Ly9sb2NhbGhvc3Q6ODA4MC9LaVdlYlBvcnRhbC9hdXRoIiwiYXVkIjoiMzJkY2VlY2UtODI2Yy00Yjk4LTljMmQtYjE2OTc4ZjBjYTZhIiwiZXhwIjoxNjI1MjQ3OTMxfQ.7vlV1oIvz78kmIYwXks-p3PmhRnK6KV2pGpo_ngoAPY #> #> Attributes: #> url: #> type: Bearer #> expires: 2021-07-02 17:45:31 UTC
#> [1] FALSE
#> Time difference of 24 hours