Connect Accounts
- Establish a connection between a user and their financial institution
- Know when your requested data is ready for retrieval
- Refresh a connection to get the latest data
Assumptions
The following guide assumes that you've already:
- Installed, configured, and deployed your self-hosted Universal Connect Widget, and have access to the URL for your self-hosted UCW instance.
- Although optional, we encourage you to add security to restrict usage of your hosted UCW outside of your application.
- A user has been created on your platform.
Workflow
To retrieve data for an end user in the Universal Connect Widget, you must first establish a connection using the following workflow:
- Configure the widget URL with job type(s) and user ID.
- Load the widget for the end user to search for an institution, select that institution, and provide their credentials.
- Listen for the memberConnected postMessage.
1. Configure the Widget URL
Configure the widget URL that you'll later use to embed the widget.
Example Usage
<iframe src="www.your-widget-url.com/widget?jobTypes=accountOwner&userId=test-user-id" />
The widget iframe must include the following required parameters in the URL:
jobTypes
: Combo jobs used to gather data. You may request multiplejobTypes
using a comma separated list in thejobTypes
query parameter. These job types are available:accountNumber
: Account numbers and routing/transit numbers.transactionHistory
: A set timeframe of transaction history for an account.accountOwner
: Available customer data.transactions
: Latest transactions.
userId
: The unique identifier of the user to make or refresh a connection with. The sameuserId
must be used when making calls to the data endpoints.
You can optionally set the UCP ID of a specific institution using the institutionId
parameter to skip search, send the user directly to the authorization step for the institution, and hide the back button.
Other parameters, listed in the specification, are optional.
To ensure you're retrieving the latest data for an existing connection, you must initiate its aggregation again by setting these additional parameters in the URL:
connectionId
: The connection id of the connection to be refreshed.aggregator
: The aggregator of the connection to be refreshed.institutionId
: The UCP id of the institution. Setting this will skip search, send the user directly to the authorization step for the institution, and hide the back button.
Example Usage
<iframe src="www.your-widget-url.com/widget?jobTypes=accountOwner&userId=test-user-id&connectionId=test-connection-id&aggregator=mx&institutionId=test-institution-id" />
Authentication
If you've enabled authentication in your environment configuration, the widget will require authorization.
Use the token endpoint to retrieve a one-time-use token to pass into the widget URL in the iframe. The server will set an authorization cookie that the widget will pass to the server for all requests.
For more info, see the /api/token
endpoint in our specification.
2. Load the Widget in Your Application
Pass the URL to the src
of your iframe that's embedded in your app.
Example Usage
<iframe src="www.your-widget-url.com/widget?jobTypes=accountOwner&userId=test-user-id" />
The widget handles the creation of a member
(which represents the connection between a user and a financial institution) with the selected aggregator and completes the job(s) defined in the widget URL.
3. Listen for postMessage
When a member has successfully been connected and the job is completed, the UCW will trigger a memberConnected
postMessage. When your application identifies this postMessage, you can close the widget and retrieve the data.
If you configured the widget to refresh a connection, you must still listen for this event to know when data is ready for retrieval.
An example of this event:
{
"type": "connect/memberConnected",
"metadata": {
"aggregator": "sophtron",
"member_guid": "MBR-345"
}
}
Next Steps
To learn how retrieve the data once a member is successfully connected, see Fetching Data.