Skip to main content
Build your own credential collection flow with full control over the look, feel, and UX, and Deck stores the credentials securely in the Credential Vault.
For simple credential collection flows that don’t require customization, the pre-built Auth Component is available as a drop-in React component.

How it works

Credentials go directly from the user to your server over HTTPS. Your server stores them with Deck. The credential is created immediately with unverified status and becomes verified the first time a task run authenticates successfully.

Credential statuses

When you first store a credential, it starts as unverified. The credential is verified automatically when it is used successfully in a task run. During that task run, the source may require additional input from the user — like an MFA code or a security question — which puts the task run into an interaction_required state. Once any required interactions are resolved and the task run completes successfully, the credential moves to verified. If the source rejects the credentials, the status becomes invalid.

Step-by-step implementation

1

Build a credential form

Start with a form that collects the credentials required by the source. Most sources use username_password.
2

Store the credential server-side

Your server receives the credentials and stores them with Deck. This can be an Express handler, a Next.js API route, or any server-side endpoint.
The response comes back with status: "unverified". The credentials are encrypted and stored in the Credential Vault.
3

Listen for credential events

Deck sends events to your event destination when credential statuses change.

Handling interactions

Some sources require additional input during a task run, like an MFA code or a security question. When this happens, the task run pauses and Deck fires a task_run.interaction_required event. The event includes an interaction object that describes what the source needs:
Use the fields array to render a form that collects the required input. Once you have the user’s response, submit it to resume the task run:
The task run resumes where it left off and continues to completion. A task run may require multiple interactions — for example, an MFA code followed by a security question. See the Interactions guide for more detail.
4

Show success

Once the credential is stored, show a success state and move the user forward in your product.

Handling errors

Build your UI to handle common failure cases gracefully:

Updating credentials

When a credential becomes invalid, prompt the user to re-enter their details and update the credential with a PATCH request.
The credential status resets to unverified and will be re-verified on the next task run.