When to Build a Custom UI
For most use cases, we recommend using the Auth SDK. It’s quick to implement and automatically handles MFA and other edge cases. Build a custom authentication UI only when you:- Need full UI control - Your design requires a specific authentication experience that doesn’t fit the SDK’s UI
- Have existing auth flows - You want to integrate Deck into an existing authentication system
Prerequisites
- Your Deck API credentials. Quickstart Guide
- A webhook endpoint configured and ready to receive webhooks. Webhooks Guide
- Source GUIDs for the data sources you want to connect to. Sources Guide
Integration Guide
1
Set up environment variables
Configure your Deck API credentials as environment variables. These are required to generate SDK tokens and must never be exposed in frontend code. Both keys are available in your Dashboard..env
2
Build Credential Collection Form
Create a form to collect user credentials. Most sources require username and password, but requirements vary by provider.
3
Run the EnsureConnection Job
When the user submits credentials, call the
EnsureConnection job from your server-side code. You will need to pass both the user’s credentials as well as the source you want to connect to. This job runs asynchronously and returns results via webhook.Connections stay open for 1 hour.
4
Handle MFA Challenges (If Required)
If the source or user’s preferences requires MFA, your webhook will receive an MFA challenge. Display the appropriate UI to collect the MFA answer and submit it.Collect MFA Answer from User:Submit MFA Answer:
5
Receive Access Token via Webhook
Once authentication is successful, your webhook receives the access token.Success Webhook Payload:
6
Use Access Tokens to Run Jobs
Use the access token to run jobs on behalf of the user. Jobs can read data (e.g., fetch documents, invoices) or write data (e.g., submit orders, update records).Job results are also delivered via webhook. See the Jobs guide for more information.
