Just four simple function calls can transition your application to fully passwordless authentication with the Hawcx Javascript SDK.

Pro Tip: The Hawcx Web SDK is currently available as a public beta. We’re actively enhancing the experience—your feedback helps us make it even better!

Quick Start Guide

1. Include the JavaScript SDK

import { HawcxInitializer } from "https://websdkcdn.hawcx.com/hawcx-auth.esm.min.js";

const auth = await HawcxInitializer.init('YOUR_API_KEY');

Replace 'YOUR_API_KEY' with your actual API key obtained from Hawcx.

2. Implement Authentication Flows

a. User Registration

To initiate a new user registration with an email address:

const response = await auth.signUp(email);

if (response.success) {
  console.log("OTP sent successfully. Session ID:", response.data.sessionId);

  const verify = await auth.verifyOTP(otpCode);

  if (verify.success) {
    console.log("User registration completed successfully.");
  }
}

b. User Login

Authenticate existing users with their registered email:

const response = await auth.signIn(email);

if (response.success) {
  const { access_token, refresh_token } = response.data;
  sessionStorage.setItem('access_token', access_token);
  console.log("Login successful.");
} 

Congratulations! You’ve now enabled passwordless authentication with Hawcx in your web application.

Pro Tip: Consider implementing multi-device support to enable login/signup across different devices.

For further details, refer to the API Reference.

Try it out!

Example App

Check out our example app on GitHub for a complete implementation.