ZivaCare Connect


102 views 0

Setting up ZivaCare Connect popup

Details on launching ZivaCare Connect popup from within your application.

Launching ZivaCare Connect popup from within your application has 3 simple steps:

1. Include our javascript library. This will create a global ZivaConnect JS object.

<script src='https://developer.zivacare.com/connect.js'></script>

2. Add the “Connect Health Data” button to your application.

<button class='btn btn-small btn-info' id='connect-health-data-btn'>
    <img alt="" src="http://developer.zivacare.com/bundles/zivacareadmin/images/logo_icon.png">
    <strong>CONNECT</strong> HEALTH DATA

3. Use the ZivaConnect object to launch the ZivaCare Connect popup.

Launching ZivaCare Connect popup

To launch ZivaCare Connect popup (when a user clicks on the connect health data button for the first time) you need to call the ZivaConnect.open method with the few options, as outlined below:

 	var options = { 
            clientId: encodeURIComponent('PUBLIC_CLIENT_ID'),
            clientUserId: encodeURIComponent('UNIQUE_USER_ID_IN_YOUR_APPLICATION'),
            finish: function(err, sessionTokenObject) {
                // When user finishes health data connection to your app the `finish` function will be called. 

Calling ZivaConnect.open will POST the specialToken to your server to a route withc handles it.The best practice for doing this is to call ZivaConnect.open inside the onclick handler for the connect-health-data-btn button we added earlier.

Configurable options reference

clientId A unique public id for your application. Copy it from App settings page in the developer portal.
clientUserId Unique identifier for a user inside your app. Can be email (which needs to be encoded using encodeURIComponent()).
finish Callback function that will be called after user grants access to his health data.
close Optional callback that will be called after user just closes popup.

Error codes

invalidClient Invalid Client.
invalidClientUserId The `clientUserId` specified either doesn’t exist, or does not match the given clientId.
invalidClientIdFormat Invalid `clientId` format.
noAccess The `clientUserId` does not have access to application.
invalidClientId Invalid `clientId`.

Was this helpful?

By continuing to use the site, you agree to the use of cookies. More information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.