Skip to main content

Node

Initial Setup

The LoginID Server SDK enables you to perform operations which are protected, enabling much more robust functionality for your users.

Create API Credential on the Dashboard

An application must be created on the LoginID Dashboard in order to correctly configure the Server SDK.

Once logged into the dashboard, navigate to the Applications tab in the sidebar, select “Add Application,” and select Management / Server.

In the resulting form, you must create a name for your application and provide an API credential to be associated with this application. If you have already created an application, we suggest using the naming convention of “{my-app) server.”

When adding the API credential, you can either upload your own public key, or have us generate a key pair on your behalf.

note

All API calls made from a Management integration type require an API Service Token

Add SDK to Existing Application

npm install --save @loginid/node-sdk

Add SDK to Existing Application

NPM
import WebSDK from '@loginid/node-sdk';
const lAdmin = new WebSDK(CLIENT_ID, PRIVATE_KEY, BASE_URL);

Application API Reference

LoginId Class

Constructor

This server SDK leverages either a web or mobile application and requires an API credential to be assigned to that integration.


Helper Functions

generateServiceToken

Generate a service token, to be used when making protected API calls. Not required when calling other methods with the server SDK.

verifyToken

Verify a JWT returned upon user authentication.


generateTxAuthToken

Generates the bearer token to be used in the transaction confirmation flow, as it has a specific format slightly different from the standard service tokens. This function generates that token. If calling the createTx method, this function does not need to be called first.

createTx

Create a transaction. This is typically the first step of the transaction confirmation flow.

verifyTransaction

Verify the jwt returned in the confirmTransaction flow.

Management API Reference

Overview

LoginIdManagement Constructor

This server SDK can be used with a management application and requires an API credential to be assigned to that integration. All calls made from this SDK are intended to be backend-to-backend calls, as the operations are sensitive.

Credential Management Functions

getCredentials

Get an exhaustive list of credentials for a given user.

renameCredential

Rename a given credential.

revokeCredential

Revoke a credential so it can longer be used.


generateCode

Generate a code, which can be used for a variety of purposes. Check out the guides section for how various ways these codes can be used.

authorizeCode

Authorize a code which was previously generated through the generateCode method.

invalidateAllCodes

Invalidate all codes of a given type for a specific user.


User Management Functions

getUserId

Get a user identifier for a given username.

deactivateUserById

Temporarily deactivate a user account.

activateUserById

Re-activate a previously deactivated user profile.

deleteUserById

Deletes a user profile based on a userId as the input. This operation cannot be undone.

deleteUserByUsername

Deletes a user profile based on a username as the input. This operation cannot be undone.

createUserWithoutCredentials

Adds a new user without credentials. The new user can create new credentials with recovery flow