Using this package you can interact with the 'Aplos NCA API'< https://docs.aplosanalytics.com/> using standard R functions. This will allow you to authenticate with your 'Aplos NCA' account, upload input datasets, initiate analyses, and download results.
R package to use Aplos NCA API calls. This package includes functions that do the following tasks:
Every API call needs an Aplos NCA JWT. A JWT expires one hour after it is issued; the package renews it automatically with an Aplos NCA Refresh Token when less than 20 minutes remain, so you authenticate once and keep working.
There are two ways to obtain the pair.
Supply the Cognito client ID, your username, password, and AWS region:
token <- aplos_get_jwt(client_id = "your_client_id",
username = "your_username",
password = "your_password",
region = "us-east-1")
Cognito returns an Aplos NCA JWT and an Aplos NCA Refresh Token at the same
time. The package keeps both and uses the refresh token to renew the JWT for
the rest of the R session. return_refresh = TRUE returns both if you want to
store the refresh token yourself.
If you sign in through single sign-on (SSO), or you already hold a refresh token, copy the Aplos NCA Refresh Token from your profile page (API Settings) in the Aplos NCA web application. Save it with the client ID and region:
REFRESH_TOKEN="your_refresh_token"
COGNITO_CLIENT_KEY="your_cognito_client_id"
COGNITO_REGION="us-east-1"
token <- aplos_import_jwt("~/.token")
The package exchanges it for an Aplos NCA JWT and renews that JWT the same way. The refresh token can be reused in later sessions until it expires or is revoked, so one file is enough.
The refresh token, client ID, and region belong to a single Aplos NCA instance (development, demo, or production). Those instances run separate Cognito user pools, so credentials are not interchangeable between them.
The URL (for example https://api.app.aplos-nca.com) is not used to obtain
either token — Cognito is addressed with the client ID and AWS region. The URL
identifies the Aplos NCA API and is passed to the analysis functions:
result <- aplos_get_upload_url("data.csv", "https://api.app.aplos-nca.com", token)
Pull requests are welcome. For major changes, please open an issue first.
Report bugs at https://github.com/AplosAnalytics/AplosNCA/issues.