Link Webview SDK
Reference for integrating with the Link Webview JavaScript SDK
The use of webviews to present link is deprecated and not recommended. Instead, use Hosted Link or one Plaid's official SDKs for Android, iOS, and React Native.
Beginning January 1, 2024, all Webview-based integrations will need to extend the Webview handler for redirects in order to support Chase OAuth. This can be accomplished with code samples for iOS and Android. For more details, see Extending webview instances to support certain institutions in the OAuth Guide and the in-process Webview deprecation notice.
Overview
To integrate and use Plaid Link inside a Webview, we recommend starting with one of our sample Webview apps:
Each example app is runnable (on both simulators and devices) and includes code to initialize Link and process events sent from Link to your app via HTTP redirects.
Installation
Link is optimized to work within Webviews, including on iOS and Android. The Link initialization URL to use for Webviews is:
1https://cdn.plaid.com/link/v2/stable/link.html
The Link configuration options for a Webview integration are passed via querystring rather than via a client-side JavaScript call. See the create section below for details on the available initialization parameters.
Communication between Link and your app
Communication between the Webview and your app is handled by HTTP redirects rather than client-side JavaScript callbacks. These redirects should be intercepted by your app. The example apps include sample code to do this.
All redirect URLs have the scheme plaidlink
. The event type is communicated via the URL host and data is passed via the querystring.
1plaidlink://
There are three supported events, connected
, exit
, and event
, which are documented below.
Create
isWebview
true
, to trigger the Webview integration.token
link_token
to authenticate your app with Link. This is a short lived, one-time use token that should be unique for each Link session. In addition to the primary flow, a link_token
can be configured to launch Link in update mode. See the /link/token/create
endpoint for a full list of configurations.receivedRedirectUri
receivedRedirectUri
is required to support OAuth authentication flows when re-launching Link on a mobile device. Note that any unsafe ASCII characters in the receivedRedirectUri
in the webview query string must be URL-encoded.key
public_key
is no longer used for new implementations of Link. If your integration is still using a public_key
, see the migration guide to upgrade to using a link_token
. See the maintenance guide to troubleshoot any public_key
issues.1https://cdn.plaid.com/link/v2/stable/link.html2 ?isWebview=true3 &token="GENERATED_LINK_TOKEN"4 &receivedRedirectUri=
connected
The connected
event is analogous to the onSuccess
callback in Link Web and is sent when a user successfully links an Item. The following information is available from the querystring event:
public_token
institution_name
'Wells Fargo'
institution_id
accounts
accounts
will only include selected accounts._id
account_id
type
subtype
verification_status
verification_status
. See Auth accounts for a full list of possible values.class_type
business
or personal
account.transfer_status
COMPLETE
– The transfer was completed.INCOMPLETE
– The transfer could not be completed. For help, see Troubleshooting transfers.
COMPLETE
, INCOMPLETE
link_session_id
1plaidlink://connected2 ?public_token=public-sandbox-fb7cca4a-82e6-47073 &institution_id=ins_34 &institution_name=Chase5 &accounts='[{"_id":"QPO8Jo8vdDHMepg41PBwckXm4KdK1yUdmXOwK", "meta": {"name":"Plaid Savings", "number": "0000"}, "subtype": "checking", "type": "depository" }]'6 &link_session_id=79e772be-547d-4c9c-8b76-4ac4ed4c441a
1"accounts": [2 {3 "_id": "ygPnJweommTWNr9doD6ZfGR6GGVQy7fyREmWy",4 "meta": {5 "name": "Plaid Checking",6 "number": "0000",7 },8 "type": "depository",9 "subtype": "checking",10 "verification_status": null11 },12 {13 "_id": "9ebEyJAl33FRrZNLBG8ECxD9xxpwWnuRNZ1V4",14 "meta": {15 "name": "Plaid Saving",16 "number": "1111"17 },18 "type": "depository",19 "subtype": "savings"20 }21 ...22]
exit
The exit
event is analogous to the onExit
callback and is sent when a user exits Link without successfully linking an Item, or when an error occurs during Link initialization. Note that on Android devices, an exit
event will not be sent if the user exits Link through a system action, such as hitting the browser back button. The following information is available from the querystring:
status
requires_questions
requires_selections
requires_code
choose_device
requires_credentials
requires_account _selection
requires_oauth
institution_not_found
institution_not _supported
error_type
error_code
error_type
has a specific set of error_codes
.error_message
display_message
null
if the error is not related to user action. This may change over time and is not safe for programmatic use.institution_name
Wells Fargo
institution_id
link_session_id
request_id
1plaidlink://exit2 ?status=requires_credentials3 &error_type=ITEM_ERROR4 &error_code=ITEM_LOGIN_REQUIRED5 &error_display_message=The%20credentials%20were%20not%20correct.%20Please%20try%20again.6 &error_message=the%20credentials%20were%20not%20correct7 &institution_id=ins_38 &institution_name=Chase9 &link_session_id=79e772be-547d-4c9c-8b76-4ac4ed4c441a10 &request_id=m8MDnv9okwxFNBV
event
The event
message is analogous to the Link Web onEvent
callback and is called as the user moves through the Link flow. The querystring will always contain all possible keys, though not all keys will have values. The event_name
will dictate which keys are populated.
event_name
AUTO_SUBMIT_PHONE
/link/token/create
call and the user has previously consented to receive OTP codes from Plaid.BANK_INCOME_INSIGHTS _COMPLETED
CLOSE_OAUTH
CONNECT_NEW _INSTITUTION
ERROR
error_code
metadata.FAIL_OAUTH
HANDOFF
INSTANT_MICRODEPOSIT _AUTHORIZED
MATCHED_SELECT _INSTITUTION
routing_number
was provided when calling /link/token/create
. To distinguish between the two scenarios, see metadata.match_reason
.MATCHED_SELECT_VERIFY _METHOD
OPEN
OPEN_MY_PLAID
OPEN_OAUTH
SAME_DAY_MICRODEPOSIT _AUTHORIZED
SEARCH_INSTITUTION
SELECT_BRAND
SELECT_BRAND
event is only emitted for large financial institutions with multiple online banking portals.SELECT_DEGRADED _INSTITUTION
DEGRADED
health status and was shown a corresponding message.SELECT_DOWN _INSTITUTION
DOWN
health status and was shown a corresponding message.SELECT_FILTERED _INSTITUTION
SELECT_INSTITUTION
SKIP_SUBMIT_PHONE
SUBMIT_ACCOUNT_NUMBER
account_number_mask
metadata to indicate the mask of the account number the user provided.SUBMIT_CREDENTIALS
SUBMIT_DOCUMENTS
SUBMIT_DOCUMENTS_ERROR
SUBMIT_DOCUMENTS _SUCCESS
SUBMIT_MFA
SUBMIT_OTP
SUBMIT_PHONE
SUBMIT_ROUTING_NUMBER
routing_number
metadata to indicate user's routing number.TRANSITION_VIEW
TRANSITION_VIEW
event indicates that the user has moved from one view to the next.VERIFY_PHONE
VIEW_DATA_TYPES
error_type
ERROR
, EXIT
.error_code
ERROR
, EXIT
.error_message
ERROR
, EXIT
.exit_status
EXIT
institution_id
institution_name
institution_search _query
SEARCH_INSTITUTION
.is_update_mode
OPEN
.match_reason
returning_user
or routing_number
if emitted by: MATCHED_SELECT_INSTITUTION
.
Otherwise, this will be SAVED_INSTITUTION
or AUTO_SELECT_SAVED_INSTITUTION
if emitted by: SELECT_INSTITUTION
.mfa_type
code
, device
, questions
, selections
. Emitted by: SUBMIT_MFA
and TRANSITION_VIEW
when view_name
is MFA
view_name
TRANSITION_VIEW
.ACCEPT_TOS
CONNECTED
CONSENT
CREDENTIAL
DATA_TRANSPARENCY
DATA_TRANSPARENCY _CONSENT
DOCUMENTARY _VERIFICATION
ERROR
EXIT
INSTANT_MICRODEPOSIT _AUTHORIZED
KYC_CHECK
LOADING
MATCHED_CONSENT
MATCHED_CREDENTIAL
MATCHED_MFA
MFA
NUMBERS
OAUTH
RECAPTCHA
RISK_CHECK
SAME_DAY_MICRODEPOSIT _AUTHORIZED
SCREENING
SELECT_ACCOUNT
SELECT_BRAND
SELECT_INSTITUTION
SELECT_SAVED_ACCOUNT
SELECT_SAVED _INSTITUTION
SELFIE_CHECK
SUBMIT_PHONE
VERIFY_PHONE
VERIFY_SMS
request_id
link_session_id
link_session_id
is a unique identifier for a single session of Link. It's always available and will stay constant throughout the flow. Emitted by: all events.timestamp
2017-09-14T14:42:19.350Z
. Emitted by: all events.selection
selection
is used to describe selected verification method, then possible values are phoneotp
or password
; if selection
is used to describe the selected Flexible Auth flow, then possible values are flow_type_manual
or flow_type_instant
. Emitted by: MATCHED_SELECT_VERIFY_METHOD
and SELECT_AUTH_TYPE
.1plaidlink://event2 &event_name=SELECT_INSTITUTION3 ?error_type=ITEM_ERROR4 &error_code=ITEM_LOGIN_REQUIRED5 &error_message=the%20credentials%20were%20not%20correct6 &exit_status7 &institution_id=ins_558 &institution_name=HSBC9 &institution_search_query=h10 &mfa_type11 &view_name=ERROR12 &request_id13 &link_session_id=821f45a8-854a-4dbb-8e5f-73f75350e7e714 ×tamp=2018-10-05T15%3A22%3A50.542Z
OAuth
Using Plaid Link with an OAuth flow requires some additional setup instructions. For details, see the OAuth Guide.
Supported platforms
Plaid officially supports WKWebView on iOS 10 or later and Chrome WebView on Android 4.4 or later.