
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
humanapi-connect-client
Advanced tools
[](https://nodei.co/npm/humanapi-connect-client/)
1.x documentation?The documentation below is for humanapi-connect-client@2. We have recently released a new Connect integration client version that replaces the old 1.x.x version that has been deprecated.
It is recommended that you use this new client version which is backwards compatible to make the transition easier.
Click here for humanapi-connect-client@1.x documentation.
Connect is the authentication widget for your application to allow users to share their health data. After a user has successfully granted you access to their health data using Connect, you'll be able to query their disparate data directly from Human API.
Please refer to the connect guide for full instructions on how to use the Connect client.
This module can be used by loading the script from our CDN or by installing the npm module.
To use the library via our CDN you can include the following script source:
<script src="https://cdn.humanapi.co/humanapi-connect-client@latest.js">
To install the npm module and use it with e.g. React:
npm install --save humanapi-connect-client
To use this library regardless of the method used, you first need to acquire a session token and set it as the data-attribute data-hapi-token of an element that supports the onclick event (e.g. a button). Then, you need to add the class hapi__token-container to the parent of the element that has the token value, e.g.:
<div class="hapi__token-container">
<button data-hapi-token="<your session token>">Open Connect</button>
</div>
Note: Make sure that the element containing the class hapi__token-container is rendered on page load.
The library will then automatically configure all elements with the data-hapi-token attribute under that parent, to allow them to open the Connect window.
humanapi-connect-client can be configured to respond to the following lifecycle hooks:
connect: This event will be fired after a source has been successfully connecteddisconnect: This event will be fired after a source has been disconnectedclose: This event will be fired after the Connect window is closed, regardless of whether sources were connected or noterror: This event fires in case theres an error with the library e.g. a token container element is not foundTo add a lifecycle hook to a particular event you have to use the on(eventName, eventListener) method, e.g.:
HumanConnect.on("close", (response) => {console.log("close", response)});
HumanConnect.on("connect", (response) => {console.log("connect", response)});
HumanConnect.on("disconnect", (response) => {console.log("disconnect", response)});
HumanConnect.on("error", (response) => {console.error("error", response)});
Any function listening for lifecycle events defined by Connect will receive a payload with the following schema:
{
sessionResults: {
// List of sources the user connected during this session
connectedSources: [
{
name: "Starfleet Pharmacy",
id: "5b1daf3f079c652eaf41fd23"
}
],
// List of sources the user disconnected during this session
disconnectedSources: [],
// List of sources the user requested during this session
requestedSources: [
{
address: "742 Evergreen Terrace, OH",
healthSystem: "N/A",
location: {
latitude: 41.3289,
longitude: -105.6928
},
physician: "Dr. John Smith",
website: "drjohnsmith.example.com"
}
]
},
// List of sources the user currently has connected with your app
currentConnections: [
{
name: "Starfleet Pharmacy",
id: "5b1daf3f079c652eaf41fd23"
}
],
// List of sources the user has requested
requestedProviders: [
{
address: "742 Evergreen Terrace, OH",
healthSystem: "N/A",
location: {
latitude: 41.3289,
longitude: -105.6928
},
physician: "Dr. John Smith",
website: "drjohnsmith.example.com"
}
]
}
If you are using the script via the CDN and the source location is src=https://cdn.humanapi.co/humanapi-connect-client@latest.js you will be upgraded automatically. The new version is backwards compatible so there is no other change needed for the time being.
If you are using a specific version of the library, e.g. src=https://cdn.humanapi.co/humanapi-connect-client@1.2.4.js you can just use humanapi-connect-client@latest.js or specify a 2.x.x version, e.g. humanapi-connect-client@2.0.4.js
npm install humanapi-connect-clientNote: This project uses Node 14.
To generate a new pre-release version, you can run the following command:
npm version prerelease --preid=beta
This will bump the version to the next pre-release version, e.g. from 2.0.0 to 2.0.1-beta.0. After that you can publish the new version with:
npm publish --tag beta
And then push the new tag to the repository:
# Example
git push origin v2.0.1-beta.0
To generate a new version, you can run the following command:
npm version patch
After that you can publish the new version with:
npm publish
And then push the new tag to the repository:
# Example
git push origin v2.0.1
FAQs
[](https://nodei.co/npm/humanapi-connect-client/)
The npm package humanapi-connect-client receives a total of 781 weekly downloads. As such, humanapi-connect-client popularity was classified as not popular.
We found that humanapi-connect-client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 41 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.