Skip to main content

Track Action

API schema

This method lets you track authentication actions performed by users and initiate challenges via the Authsignal pre-built UI, Web SDK or Mobile SDK.
const request = {
  userId: "dc58c6dc-a1fd-4a4f-8e2f-846636dd4833",
  action: "signIn",
  attributes: {
    redirectUrl: "https://yourapp.com/callback",
  },
};

const response = await authsignal.track(request);

if (response.state === "CHALLENGE_REQUIRED") {
  // Present challenge via Authsignal pre-built UI URL
  const url = response.url;
} else if (response.state === "ALLOW") {
  // Allow the user to sign in
} else if (response.state === "BLOCK") {
  // Block the user from signing in
}
Learn more about how to track actions to implement MFA or passwordless login flows.

Get Action

API schema

This method lets you retrieve information about an action which was previously tracked.
const request = {
  userId: "dc58c6dc-a1fd-4a4f-8e2f-846636dd4833",
  action: "signIn",
  idempotencyKey: "83d07321-9bba-4f08-a871-02e2af813b72",
};

const response = await authsignal.getAction(request);

Update Action

API schema

This method lets you manually update the state of an action that was previously tracked.
const request = {
  userId: "dc58c6dc-a1fd-4a4f-8e2f-846636dd4833",
  action: "signIn",
  idempotencyKey: "83d07321-9bba-4f08-a871-02e2af813b72",
  attributes: {
    state: "REVIEW_REQUIRED",
  },
};

const updatedAttributes = await authsignal.updateAction(request);