Rate this page:

How to automate user login with OTT

There are some cases when you need to login users into a web phone automatically, but don't want a plain text password (which is accepted by the login method) to be available in JavaScript code. This is where we can use the loginWithOneTimeKey method to log in.

Let's assume that you need to log a user myuser into an application myapp in your Voximplant account myaccount, and this user has the password mypass.

  1. Add a handler for the AuthResult event.
  2. Request one-time authentication login key using the requestOneTimeLoginKey function.
  3. Calculate token on your backend.

1) myuser doesn’t include @appname.accname.voximplant.com;

2) this formula allows you to store only hashes on the backend, not passwords.

  1. Send this token using the loginWithOneTimeKey function.
  2. Finally, you will receive AuthResult with result == true if the correct password was specified.


Example backend function PHP:

echo md5($_REQUEST['key'].'|'.md5($myuser.':voximplant.com:'.$mypass));


require 'digest/md5' concat Digest::MD5.hexdigest(request.POST['key']+'|'+Digest::MD5.hexdigest(myuser+":voximplant.com:"+mypass))


const app = express();

let md5 = crypto.createHash('md5');

app.use(bodyParser.urlencoded({ extended: false }));

app.post('/', cors(), (req, res) => {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  const hash = md5.update(`${req.body.appUser}:voximplant.com:${req.body.appUserPassword}`).digest('hex');
  md5 = crypto.createHash('md5')
  const token = md5.update(`${req.body.key}\|${hash}`).digest('hex');


public class StartPoint {
  private static final String login = "";
  private static final String pass = "";
  private static final String HASH;
  static {
    HASH = DigestUtils.md5DigestAsHex((login + ":voximplant.com:" + pass).getBytes());
  public String getHash(@PathVariable String login) {
    String key = login + "|" + HASH;
    return DigestUtils.md5DigestAsHex(key.getBytes());
  public static void main(String[] args) {
    SpringApplication.run(StartPoint.class, args);