nuclei-js-common/api/auth#
clearTokens#
Returns#
void
login#
Log in with username/password. Returns either the logged-in user (tokens stored),
or { totp_required: true, totp_token } when the account has 2FA enabled β in which
case the caller must collect a code and call verifyTotp(totp_token, code).
Parameters#
| Parameter | Type |
|---|---|
creds |
Credentials |
Returns#
Promise<LoginResult>
logout#
Returns#
Promise<void>
setInitialPassword#
Set a permanent password on first login (for admin-invited accounts that logged in with a temporary password). Requires an authenticated session.
Parameters#
| Parameter | Type |
|---|---|
newPassword |
string |
Returns#
Promise<void>
verifyTotp#
Second step of 2FA login: exchange the pending token + TOTP/recovery code for tokens.
Parameters#
| Parameter | Type |
|---|---|
totpToken |
string |
code |
string |
Returns#
Promise<UserInfo>
Credentials#
Properties#
password#
username#
LoginSuccess#
Properties#
totp_required#
user#
TotpRequired#
Server signalled the account has 2FA enabled β exchange totp_token via verifyTotp.