When configured properly, the package keeps a memory of
the token and its expiry date and time for wrapper functions to use and to
prevent requesting new tokens too frequently. The get_token
function
first searches the package environment for a token then proceeds to search for a
cached token file. If a token cannot be found in either of these places,
a new token is requested from the Lufthansa API using the user's credentials.
The token in the package environment only lasts during an R session. To use the same
token between R sessions, the token and its expiry can be cached using the option
options(lufthansar_token_cache = TRUE)
. The cached token is stored in a file
called '.lufthansa-token' in the current working directory. Care must be taken
to prevent the file from making the file public. For example, by adding it to a
'.gitignore' file.
1 |
The token as a string
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.