authenticate: Authenticate

View source: R/authenticate.R

authenticateR Documentation

Authenticate

Description

Authenticates with CellEngine.

Usage

authenticate(username = NA, password = NA, otp = NA, token = NA)

Arguments

username

Your username or email address. If omitted, not available from the environment variable CELLENGINE_USERNAME, and running in an interactive session, a prompt will be displayed.

password

Your password. If omitted, not available from the environment variable CELLENGINE_PASSWORD, and running in RStudio or the getPass library is installed, a prompt will be displayed.

otp

A one-time passcode, if your account is configured with two-factor authentication. If omitted and in an interactive session, a prompt will be displayed if required. Note that this must be a string.

token

A Personal Access Token. See the CellEngine documentation for more information. If provided, username, password, and otp will be ignored.

Details

There are two ways of authenticating:

  • Username and password. Use this to authenticate a user in a dynamic session.

  • API token. This is the preferred method for unattended applications (such as LIMS integrations) because it allows a limited set of permissions to be granted to the application.

These values can either be passed to the authenticate() function, or provided through environment variables named CELLENGINE_USERNAME, CELLENGINE_PASSWORD and CELLENGINE_AUTH_TOKEN. otp cannot be provided as an environment variable due to its short lifespan.

For security, you should not store your password in plain text, and you should ensure that your R history does not store your password. Instead, consider setting an environment variable (see examples).

Examples

## Not run: 
# Attempts to retrieve credentials from environment variables, falling back
# to prompting for username and password (and OTP if configured):
authenticate()

# Attempts to retrieve credentials from environment variables, falling back
# to prompting for password (and OTP if configured):
authenticate("username")

# Using an API token:
authenticate(token = "cep_abcdefghijklmnopqrstuvwxyz1234567890")

## End(Not run)

primitybio/cellengine-r-toolkit documentation built on Oct. 19, 2024, 1:17 a.m.