Automated Voximplant SDK login

Automated Voximplant SDK login

There are some cases when you need to login users into web phone automatically, but don't want plain text password (that is accepted by VoxImplant.getInstance().login()) to be available in JavaScript code.

We have a solution for this problem. Let's assume that you need to login user named myuser to application myapp in your Voximplant account named myaccount, and that user has password mypass.

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

    PLEASE NOTICE that myuser doesn’t include 

  4. Send this token using loginWithOneTimeKey function
  5. Finally you should receive AuthResult with result == true if correct password was specified.


//app.js on client
// Please, change this data before go.
const appUser = 'APPLICATIONUSER';
const appUserPassword = 'SECUREPASSWORD';
const appName = 'VOXAPPLICATION';
const account = 'ACCOUNT';
const URI = `${appUser}@${appName}.${account}`;
//Request key from server
//Listen server response
VoxImplant.getInstance().addEventListener(VoxImplant.Events.AuthResult, e => {
  log(`AuthResult: ${e.result}`);
  if (e.result) {
    //Login successful
  } else {
    if (e.code == 302) {
      //IMPORTANT: You should always calculate the token on your backend!
      $.post('/calckey/', {
        key: e.key
      }, token => {
        VoxImplant.getInstance().loginWithOneTimeKey(URI, token);
      }, 'text');


Example backend function PHP:

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



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



var md5 = crypto.createHash('md5');
response.writeHead(200, {"Content-Type": "text/plain"});



public class StartPoint {
  private static final String login = "";
  private static final String pass = "";
  private static final String HASH;
  static {
    HASH = DigestUtils.md5DigestAsHex((login + "" + pass).getBytes());
  public String getHash(@PathVariable String login) {
    String key = login + "|" + HASH;
    return DigestUtils.md5DigestAsHex(key.getBytes());
  public static void main(String[] args) {, args);
Tags:ios sdkweb sdkandroid sdk
B6A24216-9891-45D1-9D1D-E7359CEB8282 Created with sketchtool.


Add your comment

To leave a comment, first confirm that you are not a robot. It's free


Get your free developer account or talk with our sales team to learn more about Voximplant solutions
Contact sales

Please complete this field.

Please complete this field.

Please complete this field.

Choose the solution

Please complete this field.

Please complete this field.