Skip to main content

Client-side Auto-login

Not recommended

This mechanism is not as reliable as Single Sign-on, and it produces an unusual user experience. We strongly recommend using Single Sign-on if possible.

Prerequisites

  • You must have a login page with a username/email address field and password.
  • You must be willing to write and run JavaScript on this page.
  • You must be willing to allow the login page to be iFramed.

Theory of operation

  1. A user is taken directly to your login page.
  2. The login page sends a message to TestBox asking for credentials
  3. TestBox responds with credentials
  4. Log the user in by POST-ing your form as usual.

Whimsical diagram to go here describing the comms flow

Example Implementation

Install the @testboxlab/client-side-auto-login package.

Not ready yet

This package is not ready for public release yet, it currently outlines a hypothetical possibility.

import { TestBoxAutoLogin } from '@testbox/client-side-auto-login';

TestBoxAutoLogin.initialize(({ username, password }) => {
document.querySelector('#username').value = username;
document.querySelector('#password').value = password;
document.querySelector('#go').click();
});