Start Building

LastPass Developer Documentation

Show/hide navigation

Sample Codes – Auth


Before using the authentication API you must set up the file with the appropriate key values.

  • Open the file with a text editor. This file is located under AuthAPI/java-auth/src/test/resources/ for java samples, AuthAPI/python-auth/ for python, and AuthAPI/nodejs-auth/ for NodeJS samples.
  • Log into the LastPass Admin Portal and open the “Advanced Options” tab on the left side menu. Select “Keys” from the submenu, and copy the LastPass MFA Login key value.

  • Then set mfa_key and generic_api_key properties in your file.


Java 1.8 samples can be found in AuthAPI/java-auth folder. test class shows how to authenticate with LastPass. Before testing you need to set USERNAME attribute to your user’s email. Then go to main mehtod and check the available authentication modes: plain or encrypted, synchronous or asynchronous.

Compile the project with maven and then execute the tests. You can user your favorite IDE too.


Python 3 samples can be found in AuthAPI/python-auth folder. script shows how to authenticate with LastPass through HTTPS protocol. Execute the authentication script from a command line:


NodeJS samples can be found in AuthAPI/nodejs-auth folder. The main.js script shows how to authenticate with LastPass through HTTPS protocol. Edit the main.js script and change the user name located at line 10 in main.js.

Save changes and then install and execute the script. Once executed, an authentication request will be sent to LastPass authentication service and a push notification will appear in the smartphone afterwards.


Github repositories

Authentication –

Copyright@2020LogMeIn, Inc. All Rights Reserved