> ## Documentation Index
> Fetch the complete documentation index at: https://docs.authsignal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Atomic push approvals

> Deliver push verification challenges as Atomic cards and push notifications, while approval stays signed on the device by the Authsignal Mobile SDK.

[Atomic](https://atomic.io) can deliver your [push verification](https://docs.authsignal.com/authentication-methods/app-verification/push.md) challenges. For each challenge, Authsignal starts an Atomic Action Flow. Atomic shows an approval card in your app and can send a push notification. The user taps **Approve** or **Deny** on the card, your app responds to the challenge with the Authsignal Mobile SDK, and then completes the card.

![Approval card asking the user to approve a \$298.92 payment in Dubrovnik, Croatia, with Approve and Deny buttons](https://mintcdn.com/authsignal-23/o2xK3YS6oOe4O_NK/images/docs/authentication-methods/atomic/approval-card.png?fit=max\&auto=format\&n=o2xK3YS6oOe4O_NK\&q=85\&s=43a062e43dc897d12459c1f465e3bb32)

An Atomic approval card in a banking app, styled with the app's own Atomic theme.

Atomic handles delivery and UI only. A challenge is approved or denied only when your app calls `updateChallenge`, which signs the response with the device's push credential, as with every other push provider. Nothing in Atomic can approve a challenge.

> [!NOTE]
>
> Delivery is **best-effort**, as with [managed push](https://docs.authsignal.com/authentication-methods/app-verification/managed-push.md). If Authsignal cannot start your Action Flow, the challenge still starts and can be completed from your app. The failure is recorded as a `PUSH_SEND_DOWNSTREAM_FAILED` event on the user's timeline.

## How it works

```mermaid theme={null}
sequenceDiagram
    participant F as Your web app
    participant AS as Authsignal
    participant AT as Atomic
    participant M as Mobile app
    F->>AS: Start push challenge
    AS->>AT: Start Action Flow<br/>(variables include challengeId)
    AT->>M: Approval card + push notification
    Note over M: User taps Approve or Deny
    rect rgb(191, 223, 255)
    note right of M: Authsignal Mobile SDK
    M->>AS: updateChallenge (signed by the device)
    end
    M->>AT: Complete the card
    AS-->>F: Challenge approved or denied
```

* Each push starts one flow invocation, so a retried send cannot create a second card.
* A card is a single card instance, so once the user answers it, it clears on every device.
* Each card expires with its challenge. If the challenge is resolved without the card, for example from your app's own screen or because a newer challenge replaces it, Authsignal cancels the card.

## Atomic Workbench setup

**1. Create a stream and stream container for approvals**

Create a stream for approval cards, for example **Auth**, and a stream container that shows it. Your app shows this container as the approval sheet. Note the container ID.

> [!NOTE]
>
> Every card also goes into the Atomic **All cards** stream, which can't be turned off. Don't connect **All cards** to a container in your app. Use streams and containers made for each purpose instead. If your app already shows **All cards**, filter approval cards out of it, for example with `AACCardListFilter.notEqualTo(AACCardFilterValue.byCardTemplateId(...))`.

**2. Create the Action Flow**

Create an Action Flow with an **API start endpoint** trigger and a **Send card and push notification** step that targets your approval stream.

* Declare the [variables](#flow-variables) your card uses. Authsignal sends them all as strings.
* Leave the card's **expiry unset**. Authsignal sets each card to expire with its challenge.
* You can add steps after the card, such as a confirmation card. When Authsignal cancels an approval card, it cancels only the card, not the flow.
* Turn off swipe-to-dismiss and snooze, so the user answers the card instead of hiding it.

Publish the flow, then note its ID.

![Atomic Workbench Action Flow with an API start endpoint trigger and a Send card and push notification step, whose settings show the Auth stream selected and Expiry turned off](https://mintcdn.com/authsignal-23/o2xK3YS6oOe4O_NK/images/docs/authentication-methods/atomic/action-flow.png?fit=max\&auto=format\&n=o2xK3YS6oOe4O_NK\&q=85\&s=d9b810a654b71fd9532437249f79dcb3)

The Send card step targets the Auth stream and leaves expiry off.

**3. Add Approve and Deny buttons**

Add an **Approve** link button and a **Deny** submit button. Set each button's action to **Payload**, and name them `approve` and `deny`:

```json Approve (link button) theme={null}
{"isAuthButton": true, "decision": "approved", "challengeId": "%{challengeId}", "verificationCodeRequired": "%{verificationCodeRequired}"}
```

```json Deny (submit button) theme={null}
{"isAuthButton": true, "decision": "denied", "challengeId": "%{challengeId}"}
```

`isAuthButton` tells your app the button answers the challenge, and `decision` says which way. A link button leaves the card in place, so it stays on screen while your app gets an answer from Authsignal, such as a [verification code](#verification-codes). A submit button removes the card as soon as it's tapped.

![Atomic Workbench link button settings for Approve, with the Payload action holding the decision, challengeId, isAuthButton and verificationCodeRequired values](https://mintcdn.com/authsignal-23/o2xK3YS6oOe4O_NK/images/docs/authentication-methods/atomic/approve-button.png?fit=max\&auto=format\&n=o2xK3YS6oOe4O_NK\&q=85\&s=a09df93acb68e481c6199da3a44a6df7)

The Approve link button, named approve, with its action set to Payload.

**4. Create an API client**

Under **Configuration > API > API Keys**, create an API client with permission to start Action Flows and cancel cards. Note the client ID and secret.

**5. Set up Atomic user identity**

Atomic identifies the user by the `sub` claim of a JWT your app supplies. It must equal the Authsignal `userId`, because Authsignal targets the Action Flow at that user. See [Atomic user identity](#atomic-user-identity).

**6. Configure push notifications**

To also send an OS push notification, add your app's FCM and APNs credentials under **Configuration > Notifications**.

## Portal setup

Enable [push verification](https://portal.authsignal.com/organisations/tenants/authenticators/push) for your tenant and choose **Atomic** as the push notification provider. Then enter:

| Field | Where to find it in the Atomic Workbench |
| - | - |
| **Customer API base URL** | **Configuration**, e.g. `https://12-3.customer-api.atomic.io` |
| **Environment ID** | **Configuration** |
| **Action Flow ID** | The flow's API start endpoint trigger |
| **API client ID** and **secret** | **Configuration > API > API Keys** |
| **OAuth token URL** | Optional. Leave blank to use the standard Atomic token endpoint. |

On the push verification settings page, select which [custom data points](https://docs.authsignal.com/actions-rules/rules/custom-data-points.md) to pass to your flow. They are sent as `action_<name>` and `user_<name>`.

## App integration

The examples use React Native with `@atomic.io/react-native-atomic-sdk` and `react-native-authsignal`.

> [!NOTE]
>
> On Android, `@atomic.io/react-native-atomic-sdk` 26 needs three changes to a standard React Native app:
>
> * In the root `android/build.gradle`, set `kotlinVersion = "2.3.21"` (or later) and add both `org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}` and `org.jetbrains.kotlin:compose-compiler-gradle-plugin:${kotlinVersion}` to `buildscript.dependencies`.
> * Add the Atomic Maven repository, `https://downloads.atomic.io/android-sdk/maven`, to `allprojects.repositories`.
> * In `android/app/build.gradle`, set `coreLibraryDesugaringEnabled true` and add `coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.3")`.

### Enroll the device

Add a push credential with the Authsignal Mobile SDK, as in [Push verification](https://docs.authsignal.com/authentication-methods/app-verification/push.md#enrollment). Pass only the enrollment token. You don't need a device push token, because Atomic delivers the notification.

```ts theme={null}
// token is the enrollment token from your backend, not a device push token
await authsignal.push.addCredential({ token });
```

Then start an Atomic session for the same user:

```ts theme={null}
import { Session } from "@atomic.io/react-native-atomic-sdk";

Session.login(atomicSdkApiBaseUrl, atomicSdkApiKey, atomicEnvironmentId, () => getAtomicToken(userId));
```

> [!WARNING]
>
> The SDK base URL is the **client-api** host (for example `https://12-3.client-api.atomic.io`), not the customer-api host used in the portal. The API key is the SDK key's **name**.

### Show the approval card

Your app needs the ID of the challenge it is about to show. Get it from the pending challenge when the app is in the foreground, or from the push notification the user tapped:

```ts In the foreground theme={null}
const { data } = await authsignal.push.getChallenge();
const challengeId = data?.challengeId;
```

```ts From a tapped notification theme={null}
const notification = Session.notificationFromPushPayload(payload);
const challengeId = notification?.detail.challengeId;
```

Then show the approval container filtered to that challenge, so an old card can never answer a newer challenge:

```tsx theme={null}
import {
  AACCardFilterValue,
  AACCardListFilter,
  ModalContainer,
} from "@atomic.io/react-native-atomic-sdk";

<ModalContainer
  containerId={approvalContainerId}
  configuration={{ modalContainerPosition: { type: "bottom", offset: 0 } }}
  streamFilters={[
    AACCardListFilter.equals(AACCardFilterValue.byStringVariable("challengeId", challengeId)),
  ]}
  linkButtonTapped={onApprove}
  submitButtonTapped={onDeny}
/>;
```

> [!NOTE]
>
> `ModalContainer` needs `@atomic.io/react-native-atomic-sdk` 26 or later, which requires React Native 0.84 or later. On earlier versions, use a `StreamContainer` with an explicit height.

### Approve or deny

When the user taps a button, read the decision from its payload and respond with the Authsignal Mobile SDK. Once Authsignal has the answer, complete the Approve card with the Atomic SDK. That removes it from every device and records the answer under the button's name in Atomic analytics.

```ts theme={null}
import { Session, type AACCardAction } from "@atomic.io/react-native-atomic-sdk";

function readAuthButton(action: AACCardAction) {
  // SDK 26 on Android wraps the action as { payload: AACCardAction }.
  const cardAction = (action as AACCardAction & { payload?: AACCardAction }).payload ?? action;
  const payload = (cardAction.actionPayload ?? {}) as {
    isAuthButton?: boolean;
    challengeId?: string;
    verificationCodeRequired?: string;
  };

  if (!payload.isAuthButton || payload.challengeId !== challengeId) {
    return null;
  }

  return { cardAction, payload };
}

// Approve is a link button, so the card stays until the app completes it.
async function onApprove(action: AACCardAction) {
  const button = readAuthButton(action);

  if (!button) {
    return;
  }

  await authsignal.push.updateChallenge({ challengeId, approved: true });

  await Session.onCardAction({
    type: "submit",
    cardInstanceId: button.cardAction.cardInstanceId,
    streamContainerId: button.cardAction.streamContainerId,
    submitButtonName: "approve",
  });
}

// Deny is a submit button, so Atomic has already removed the card.
async function onDeny(action: AACCardAction) {
  if (readAuthButton(action)) {
    await authsignal.push.updateChallenge({ challengeId, approved: false });
  }
}
```

### Verification codes

If push verification uses verification codes, your web app shows a code that the user must enter in the mobile app to approve. Card inputs aren't passed to your app, so collect the code in your app after the user taps **Approve**. Because Approve is a link button, the card stays on screen while the user enters it.

Authsignal sends `verificationCodeRequired` (`"true"` or `"false"`) to your flow, and the Approve payload above passes it to your app. When it's `"true"`, ask for the code before approving. Complete the card only once Authsignal accepts the code. A wrong code returns `invalid_code` without using up the challenge, so the user can try again:

```ts theme={null}
const response = await authsignal.push.updateChallenge({ challengeId, approved: true, verificationCode });

if (response.errorCode === "invalid_code") {
  // Ask again. The challenge and the card are both still there.
  return;
}

await Session.onCardAction({ type: "submit", cardInstanceId, streamContainerId, submitButtonName: "approve" });
```

The verification code itself is never sent to Atomic or to the device.

## Flow variables

Authsignal starts your Action Flow with these variables. All values are strings.

| Variable | Description |
| - | - |
| `challengeId` | The push challenge ID. Pass it to `updateChallenge`. |
| `actionCode` | The action the user is completing, such as `signIn`. |
| `title` | The notification title from the action's [push messaging template](https://docs.authsignal.com/authentication-methods/app-verification/push.md). |
| `body` | The notification body from the action's push messaging template. |
| `ipAddress` | The IP address of the device that started the challenge. |
| `userAgent` | The user agent of the device that started the challenge. |
| `timezone` | The time zone of the device that started the challenge, when known. |
| `initiatedAt` | When the challenge started (ISO 8601). |
| `expiresAt` | When the challenge expires (ISO 8601). The card expires at the same time. |
| `verificationCodeRequired` | `"true"` when the user must enter a [verification code](#verification-codes). |
| `idempotencyKey` | The idempotency key of the action. |
| `action_<name>` | Custom action data points you selected in the portal. |
| `user_<name>` | Custom user data points you selected in the portal. |

Authsignal also passes `{"challengeId": "<id>"}` as the push notification's detail, which the Atomic SDK returns from `notificationFromPushPayload`.

## Atomic user identity

Your app supplies Atomic with a JWT through the session delegate. Its `sub` claim must be the Authsignal `userId`.

* **Recommended:** mint the JWT in your backend from your own session, signed with your own key, with `sub` set to the user's Authsignal `userId`. Configure the SDK API key in the Atomic Workbench to trust your issuer.
* **Alternatively:** use an Authsignal [session](https://docs.authsignal.com/advanced-usage/session-management.md) access token. It is an RS256 JWT with `sub` set to the `userId`. Configure the SDK API key to trust your tenant's issuer, `https://<api-host>/v1/client/public/<tenantId>`.

## Troubleshooting

* **No card appears:** check that the Atomic user ID (the JWT `sub`) equals the Authsignal `userId`, and that the Action Flow is published.
* **Approval cards show up in your app's main feed:** that container shows the **All cards** stream. Connect it to a different stream, or filter approval cards out of it.
* **The card disappears before the user enters the code:** Approve is a submit button. Make it a link button, and complete the card from your app.
* **No push notification:** Atomic needs FCM and APNs credentials for your app. The card still appears in your app without them.
* **A card stays after the challenge expires:** check that the **Send card** step has no expiry of its own. A flow-level expiry overrides the one Authsignal sets.
* **Delivery failures:** see the user's [event timeline](https://docs.authsignal.com/knowledge-base/administration/view-user-activity.md) for `PUSH_SEND_DOWNSTREAM_FAILED` events with the status code and error returned by Atomic.

## Next steps

* **[Push verification](https://docs.authsignal.com/authentication-methods/app-verification/push.md)** - The full push verification flow, including enrollment and adaptive MFA
* **[Managed push](https://docs.authsignal.com/authentication-methods/app-verification/managed-push.md)** - Deliver push notifications through APNs and FCM instead


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.