The LoginID Server SDK enables you to connect to LoginID APIs in a secure, robust and secure manner. Using the SDK simplifies integrations with LoginID so that your developers can concentrate on features that improve users experiences rather than having to deal with raw API calls. This page provides the initial steps that are required to retrieve credentials and register your application with LoginID.
Create an Application 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”. For the purpose of getting started select “Backend / API” which enables the usage of management APIs.
In the resulting form set a name for your application and a web site URL if desired. After clicking “Create” you will find a “Client ID” which is needed to configure the SDK! Click “Next Step”.
The next page “API Credentials” provides three options. In any case it refers to a private / public key pair which is used by the SDK. To get started select “Generate key pair for me”. If you are setting up an application for production systems upload your own public key. If you have previously created an API Credential you can reuse it.
After selecting “Generate key pair for me” set a name for this API Credential and hit “Generate Key”. The page generates a private key in PEM format. This private key is used by the SDK. Copy the key and paste it into a private, secured file. LoginID does not persist the private key, therefore, make sure not to lose it! Hit “Complete”.
Your application is now registered and the SDK can be configured!
All API calls made from a Management integration type require an API Service Token
Add the SDK to an existing Application
The SDK is open source, uses Maven and can be found on GitHub. Clone the repository and install it as shown below (https works too instead of ssh)!
git clone email@example.com:loginid1/java-server-side-sdk.git
mvn clean install
Create an SDK Instance
There are two types of APIs available and both have their dedicated java class to use:
LoginId loginId = LoginId(CLIENT_ID, PRIVATE_KEY, BASE_URL);
LoginIdManagement mgmt = LoginIdManagement(CLIENT_ID, PRIVATE_KEY, BASE_URL); // used with credentials created on this page
An easy way to store the credentials and initialize the SDK is so use a properties file. Here is an example (shown for Mac computers):
Create a file at
Add this content (using your client_id and your private key):
for the private key set \n to separate lines from each other!
API_PRIVATE_KEY=-----BEGIN PRIVATE KEY-----\nMIGHAgEA......wkJ/7B\n-----END PRIVATE KEY-----
Try this code snippet:
Properties props = new Properties();
props.load(new FileReader(String.format("%s/%s", System.getProperty("user.home"), ".loginid/config")));
LoginIdManagement mgmt = new LoginIdManagement(props.getProperty("client_id"), props.getProperty("API_PRIVATE_KEY"), props.getProperty("base_url") );
The SDK is now ready for use. Checkout the API Reference documentation to get started!
If using a custom
base_url, you can initialize the SDK with that
base_url. Otherwise, it will default to the main LoginID production environment.
Application API Reference
This server SDK leverages either a web or mobile application and requires an API credential to be assigned to that integration.
Generate a service token, to be used when making protected API calls. Not required when calling other methods with the server SDK.
Verify a JWT returned upon user authentication.
Transaction Confirmation Related Functions
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.
Create a transaction ID. This is typically the first step of the transaction confirmation flow.
jwt returned in the
Management API Reference
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
Get an exhaustive list of credentials for a given user.
Rename a given credential.
Revoke a credential so it can longer be used.
Code Related Functions
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.
Authorize a code which was previously generated through the
Submit a code and wait for it to be authorized. You can use this method when leveraging the code to authenticate a user.
Invalidate all codes of a given type for a specific user.
User Management Functions
Get a user identifier for a given username.
Temporarily deactivate a user account.
Re-activate a previously deactivated user profile.
Deletes a user profile based on a
userId as the input. This operation cannot be undone.
Deletes a user profile based on a
username as the input. This operation cannot be undone.
Adds a new user without credentials. The new user can create new credentials with recovery flow