Authenticates a NocoDB user by email
and password
via the
POST /api/v1/auth/user/signin
API endpoint. An access token
(JWT) is generated in the process and stored in the package environment to be used in subsequent API calls.
Usage
sign_in(
hostname = pal::pkg_config_val("hostname"),
email = pal::pkg_config_val("email", require = TRUE),
password = pal::pkg_config_val("password", require = TRUE),
cache_refresh_token = TRUE
)
Arguments
- hostname
NocoDB server hostname. A character scalar.
E-mail address of the NocoDB user to authenticate with.
- password
Password of the NocoDB user to authenticate with.
- cache_refresh_token
Whether or not to write the refresh token included in the API response to disk (in the OS user cache directory). This allows to refresh an expired access token using
refresh_sign_in()
.
Details
The generated access token expires after a certain amount of time, configured by the NocoDB server via
NC_JWT_EXPIRES_IN
(defaults to 10 hours). To allow for a frictionless user
experience, a separate refresh token is cached to disk in a cookie file (unless cache_refresh_token = FALSE
). refresh_sign_in()
can then be used to
generate a new access token if necessary. Taken together, this allows for users to sign in once and remain authenticated across R session restarts without
having to provide their password again (unless the refresh token has expired or been invalidated by sign_out()
in the meantime). req_auth()
implements
this functionality.
See also
Other functions to manage NocoDB authentication:
api_tokens()
,
assert_super_admin()
,
create_api_token()
,
delete_api_token()
,
is_signed_in()
,
is_super_admin()
,
refresh_sign_in()
,
req_auth()
,
sign_out()
,
sign_up_user()
Other user:
assert_super_admin()
,
is_signed_in()
,
is_super_admin()
,
refresh_sign_in()
,
sign_out()