amcat_login | R Documentation |
Authenticate to an AmCAT instance
amcat_login(server, token_refresh = FALSE, force_refresh = FALSE, cache = NULL)
server |
URL of the AmCAT instance |
token_refresh |
Whether to enable refresh token rotation (see details). |
force_refresh |
Overwrite existing cached authentications. |
cache |
select where tokens should be cached to suppress the user menu. 1 means to store on disk, 2 means to store only in memory. |
Enabling refresh token rotation ensures added security as leaked refresh tokens also become invalidated after a short while. It is currently disabled by default as it is not fully supported by the underlying httr2 package.
If you select to store your tokens on disk in the interactive menu, they
are stored in the location indicated by
rappdirs::user_cache_dir("httr2")
.
The function needs to open a browser, which will usually only work in an
interactive session. However, you can save the returned object in an rds
file (with saveRDS()
) and tell amcat4r where to look for it:
options(amcat4r_token_cache = "path/to/location/tokens.rds")
. If you
still have issues in an interactive session, check browseURL
to see if you can set a browser manually.
an amcat4_token object
## Not run:
amcat_login("https://middlecat.up.railway.app/api/demo_resource")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.