Documentation

Documentation

Authentication via messengers instead of SMS — no per-message costs. Every authenticated user becomes reachable for notifications by phone number through the same bots. The system picks the right messenger automatically; you control the priority.

JavaScript SDK & widget

Browser UMD or embedded widget.js on your site. Replace YOUR_APP_ID with the application _id from the cabinet.

Button mode

A button appears on the page. When clicked, a popup opens with a QR code and messenger links.

Inline QR mode

The QR code and messenger tabs are shown directly on the page without a button.

widget.js

<script src="https://id.antirius.com/widget.js"></script>
<script>
  AuthBotsWidget.init({
    app_id: 'YOUR_APP_ID',
    base_url: 'https://id.antirius.com',
    poll_type: 'full',
    button_text: 'Sign in',
    theme_color: '#1976d2',
    onSuccess: function (data) {
      fetch('https://id.antirius.com/api/v1/auth/session/' + data.session_id + '?type=full')
        .then(function (r) { return r.json(); })
        .then(function (session) {
          console.log(session.token, session.user);
        });
    }
  });
</script>

Session polling mode: poll_type

Set poll_type when calling AuthBotsWidget.init. It controls which API query type the widget uses while waiting for the user in the messenger.

FieldDescription
poll_type: "full"Default. Polls with ?type=full — on success the widget receives JWT and user in onSuccess. The session is consumed after the first full response.
poll_type: "status"Polls with ?type=status only — status and messenger_opened. Safe to poll many times. No JWT until your backend calls ?type=full. Use for hosted login pages (redirect with session_id).

SDK (UMD)

<script src="https://id.antirius.com/browser/auth-bots.umd.js"></script>
<script>
  AuthBots.init({
    appId: 'YOUR_APP_ID',
    baseUrl: 'https://id.antirius.com'
  });

  // Popup login
  document.getElementById('login-btn').addEventListener('click', function () {
    AuthBots.login({ mode: 'popup' }).then(function (result) {
      console.log('JWT:', result.token);
    });
  });

  // Or embedded widget (same SDK):
  AuthBotsWidget.init({
    app_id: 'YOUR_APP_ID',
    base_url: 'https://id.antirius.com',
    poll_type: 'full',
    button_text: 'Sign in',
    theme_color: '#1976d2'
  });
</script>
<button id="login-btn" type="button">Sign in</button>

With poll_type: "full", onSuccess receives token, user, and session_id. With poll_type: "status", onSuccess fires after redirect (hosted) or you poll type=full yourself on the backend.