Connect Reference
HumanConnect.open argument properties
HumanConnect.open argument properties
Before invoking the function HumanConnect.open(options) to launch Connect, you can supply the following parameters for the options object argument:
| Attribute | Description |
|---|---|
| clientId | Your application's clientId. If you don't have one, please reach out to open a developer account |
| clientUserId | Can be an email address or any UTF-8 string to identify the user |
| token | (required) Session token initially retrieved from Human API's authentication service |
| onClose | A Javascript function with this signature: function close(response){...} |
| onConnectSource | A Javascript function with this signature: function (response){...} |
| onDisconnectSource | A Javascript function with this signature: function (response){...} |
HumanConnect.open({
token : "YOUR_TOKEN", // "session_token" or "id_token"
onClose : function(response) {
console.log("User closed Connect", response);
},
onConnectSource : function(response) {
console.log("User connected a source", response);
},
onDisconnectSource : function(response) {
console.log("User disconnected a source", response);
}
});Human Connect session response during user activity
Human Connect session response during user activity
After the user adds or removes data sources and closes Connect, your onClose callback will be invoked with a response argument. The response object is as follows:
| Property | Type | Description |
|---|---|---|
| status | String | Identifies whether the session terminated normally (SUCCESS) or abnormally : SESSION_TOKEN_INVALID, SESSION_TOKEN_EXPIRED or MISSING_SESSION_TOKEN |
| sessionResults | Object | Identifies details about the data sources which the user connected or disconnected |
| sessionResults.connectedSources | Array[Object] | Identifies data sources connected by the user during the session. The array can be empty if the user did not connect any source |
| sessionResults.disconnectedSources | Array[Object] | Identifies data sources disconnected by the user during the session. The array can be empty if the user did not disconnect any source |
| currentConnections | Array[Object] | Identifies active data sources for the user, including sources which were connected in previous sessions |
See below for an example response:
{
"status": "SUCCESS",
"sessionResults": {
"connectedSources": [
{
"name": "Starfleet Pharmacy",
"id": "5b1daf3f079c652eaf41fd23"
},
{
"name": "Cleveland Clinic",
"id": "54dc427aaa6b4cb7d6203061"
}
],
"disconnectedSources": [],
},
"currentConnections": [
{
"name": "Starfleet Pharmacy",
"id": "5b1daf3f079c652eaf41fd23"
},
{
"name": "Cleveland Clinic",
"id": "54dc427aaa6b4cb7d6203061"
}]
}Updated 18 days ago
