amcat_login: Authenticate to an AmCAT instance

View source: R/auth.R

amcat_loginR Documentation

Authenticate to an AmCAT instance

Description

Authenticate to an AmCAT instance

Usage

amcat_login(server, token_refresh = FALSE, force_refresh = FALSE, cache = NULL)

Arguments

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.

Details

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.

Value

an amcat4_token object

Examples

## Not run: 
  amcat_login("https://middlecat.up.railway.app/api/demo_resource")

## End(Not run)

ccs-amsterdam/amcat4r documentation built on April 17, 2025, 3:22 a.m.