{"__v":25,"_id":"564d1afb4567342100ad96c0","category":{"__v":2,"_id":"564d1af94567342100ad96ad","pages":["564d1afb4567342100ad96c0","564d1afb4567342100ad96c1","564d1afb4567342100ad96c2","564d1afb4567342100ad96c3","564d1c209f8c5c0d00245e15"],"project":"551375e1d04af219007ddc52","version":"564d1af84567342100ad96aa","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-03-27T02:56:41.497Z","from_sync":false,"order":2,"slug":"authenticating-users","title":"Authenticating Users"},"project":"551375e1d04af219007ddc52","user":"551375a3d04af219007ddc50","version":{"__v":1,"_id":"564d1af84567342100ad96aa","project":"551375e1d04af219007ddc52","createdAt":"2015-11-19T00:42:32.705Z","releaseDate":"2015-11-19T00:42:32.705Z","categories":["564d1af94567342100ad96ab","564d1af94567342100ad96ac","564d1af94567342100ad96ad","564d1af94567342100ad96ae","564d1af94567342100ad96af","564d1af94567342100ad96b0","564d1af94567342100ad96b1","564d1af94567342100ad96b2"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.1.0","version":"1.1"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-03-27T03:00:18.864Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"Human Connect is the authentication widget you embed into your website or application to allow your users to share their health data with your apps and services. After a user has successfully granted you access to their health data using Human Connect, you'll be able to query their data directly from Human API.\n\nAdditionally, after the authentication process each user from your app will have a unique Human API user record, which will automatically synchronize all of the user's health data from their disparate data sources.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/mAGfVAAcR6SGTHfpFpjs_KannectScreens.png\",\n        \"KannectScreens.png\",\n        \"2500\",\n        \"1400\",\n        \"#3ba4aa\",\n        \"\"\n      ],\n      \"caption\": \"Connect popup\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Authentication Overview\"\n}\n[/block]\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/l6BIcVLKQxaOvRKGtCEo_auth-flow.png\",\n        \"auth-flow.png\",\n        \"800\",\n        \"590\",\n        \"#1c6bb4\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n#The Human Connect authentication flow consists of 6 steps:\n\n1. Launch the Connect popup with two configuration parameters: `clientId` and `clientUserId`.\n\n2. Once a user has connected their data sources and presses the \"Done\" button, you will receive a `sessionTokenObject`.\n\n3. Post this `sessionTokenObject` to your server.\n\n4. On your server, add your unique `clientSecret` to the `sessionTokenObject` and POST it to Human API's servers.\n\n5. Human API will return: `humanId`, `accessToken`, and `publicToken`. Save this data in your system with the appropriate user model.\n\n6. Update your app status. You can now start using Human API for querying data.\n\n#Value Descriptions\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Key\",\n    \"h-1\": \"Use\",\n    \"0-0\": \"**`humanId`**\",\n    \"1-0\": \"**`accessToken`**\",\n    \"2-0\": \"**`publicToken`**\",\n    \"2-1\": \"Used to open the Human Connect popup for existing users.\",\n    \"1-1\": \"Used to pull all data for a user.\",\n    \"h-2\": \"Remarks\",\n    \"1-2\": \"This token does not expire.\",\n    \"2-2\": \"For a new publicToken, ping the publicToken endpoint.\",\n    \"0-1\": \"User ID within Human API.\",\n    \"0-2\": \"Store this with your local user model.\",\n    \"3-0\": \"`clientId`\",\n    \"4-0\": \"`clientSecret`\",\n    \"5-0\": \"`sessionTokenObject`\",\n    \"3-1\": \"Unique ID of your Human API app. Found on the app settings page of the Developer Portal.\",\n    \"4-1\": \"Unique client secret of your Human API app. Found on the app settings page of the Developer Portal.\",\n    \"5-1\": \"Consists of a `humanId`, `clientId`, and `sessionToken`.\"\n  },\n  \"cols\": 2,\n  \"rows\": 6\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"**Bold parameters** should be stored securely with your local user model.\"\n}\n[/block]\n#Modes\n\nFinally, Connect has two modes \"Create\" and \"Edit\". Create mode is launched as described above for all user's on their first launch. Once a user connects a source you'll get a set of tokens back (step 5), one of which is the `publicToken`. This token will have to be supplied to Connect on launch every subsequent time that user launches Connect to ensure proper security.\n\nThat's it! It's the same standard process regardless of the platform you launch Connect from. \n\n#Next Step: Launch Human Connect From Your Application\n\nNow that you've got the basics down, pick your platform below for specifics on how to add this flow to your application:\n[block:html]\n{\n  \"html\": \"<div>\\n\\t\\n  <a href=\\\"http://hub.humanapi.co/v1.1/docs/connect-web-guide\\\">\\n      <div class=\\\"button\\\">\\n\\n        <img class=\\\"boximg\\\" src=\\\"http://simpleicon.com/wp-content/uploads/computer.png\\\" />\\n        <h1 class=\\\"boxtitle\\\">Web</h1>   \\n\\n      </div>\\n  </a>\\n  \\n  <a href=\\\"http://hub.humanapi.co/v1.1/docs/mobile-guide-ios\\\"> \\n      <div class=\\\"button\\\">\\n        <img  class=\\\"boximg\\\" src=\\\"http://simpleicon.com/wp-content/uploads/iphone.png\\\" />\\n        <h1 class=\\\"boxtitle\\\">iOS</h1>\\n\\n      </div>\\n  </a>\\n  \\n    <a href=\\\"http://hub.humanapi.co/v1.1/docs/mobile-guide-android\\\"> \\n      <div class=\\\"button\\\">\\n        <img  class=\\\"boximg\\\" src=\\\"http://simpleicon.com/wp-content/uploads/android.png\\\" />\\n        <h1 class=\\\"boxtitle\\\">Android</h1>\\n\\n      </div>\\n  </a>\\n\\n      <a href=\\\"http://hub.humanapi.co/v1.1/docs/limited-browser-environments\\\"> \\n      <div class=\\\"button\\\">\\n        <img  class=\\\"boximg\\\" src=\\\"https://crosswalk-project.org/assets/icons/logo-cordova.png\\\" />\\n        <h1 class=\\\"boxtitle\\\">Cordova</h1>\\n\\n      </div>\\n  </a>\\n\\n</div>\\n\\n<style>\\n  h1.boxtitle{ text-align:center; font-size:2em;\\t }\\n  \\n  div.button{\\n      float: left;\\n    width: 23%;\\n    background-color: rgba(68, 152, 212, 0.13);\\n    height: 160px;\\n    margin-left:1%;\\n    margin-right:1%;\\n  }\\n  \\n  img.boximg{\\n    display: block;\\n \\t\\tmargin: 0px auto;\\n    height: 50%;\\n    padding-top: 10px;\\n  }\\n    \\n \\n</style>\"\n}\n[/block]","excerpt":"The easiest way to connect your users' health data with your application or service.","slug":"overview-of-human-connect","type":"basic","title":"Human Connect Overview"}

Human Connect Overview

The easiest way to connect your users' health data with your application or service.

Human Connect is the authentication widget you embed into your website or application to allow your users to share their health data with your apps and services. After a user has successfully granted you access to their health data using Human Connect, you'll be able to query their data directly from Human API. Additionally, after the authentication process each user from your app will have a unique Human API user record, which will automatically synchronize all of the user's health data from their disparate data sources. [block:image] { "images": [ { "image": [ "https://files.readme.io/mAGfVAAcR6SGTHfpFpjs_KannectScreens.png", "KannectScreens.png", "2500", "1400", "#3ba4aa", "" ], "caption": "Connect popup" } ] } [/block] [block:api-header] { "type": "basic", "title": "Authentication Overview" } [/block] [block:image] { "images": [ { "image": [ "https://files.readme.io/l6BIcVLKQxaOvRKGtCEo_auth-flow.png", "auth-flow.png", "800", "590", "#1c6bb4", "" ] } ] } [/block] #The Human Connect authentication flow consists of 6 steps: 1. Launch the Connect popup with two configuration parameters: `clientId` and `clientUserId`. 2. Once a user has connected their data sources and presses the "Done" button, you will receive a `sessionTokenObject`. 3. Post this `sessionTokenObject` to your server. 4. On your server, add your unique `clientSecret` to the `sessionTokenObject` and POST it to Human API's servers. 5. Human API will return: `humanId`, `accessToken`, and `publicToken`. Save this data in your system with the appropriate user model. 6. Update your app status. You can now start using Human API for querying data. #Value Descriptions [block:parameters] { "data": { "h-0": "Key", "h-1": "Use", "0-0": "**`humanId`**", "1-0": "**`accessToken`**", "2-0": "**`publicToken`**", "2-1": "Used to open the Human Connect popup for existing users.", "1-1": "Used to pull all data for a user.", "h-2": "Remarks", "1-2": "This token does not expire.", "2-2": "For a new publicToken, ping the publicToken endpoint.", "0-1": "User ID within Human API.", "0-2": "Store this with your local user model.", "3-0": "`clientId`", "4-0": "`clientSecret`", "5-0": "`sessionTokenObject`", "3-1": "Unique ID of your Human API app. Found on the app settings page of the Developer Portal.", "4-1": "Unique client secret of your Human API app. Found on the app settings page of the Developer Portal.", "5-1": "Consists of a `humanId`, `clientId`, and `sessionToken`." }, "cols": 2, "rows": 6 } [/block] [block:callout] { "type": "info", "body": "**Bold parameters** should be stored securely with your local user model." } [/block] #Modes Finally, Connect has two modes "Create" and "Edit". Create mode is launched as described above for all user's on their first launch. Once a user connects a source you'll get a set of tokens back (step 5), one of which is the `publicToken`. This token will have to be supplied to Connect on launch every subsequent time that user launches Connect to ensure proper security. That's it! It's the same standard process regardless of the platform you launch Connect from. #Next Step: Launch Human Connect From Your Application Now that you've got the basics down, pick your platform below for specifics on how to add this flow to your application: [block:html] { "html": "<div>\n\t\n <a href=\"http://hub.humanapi.co/v1.1/docs/connect-web-guide\">\n <div class=\"button\">\n\n <img class=\"boximg\" src=\"http://simpleicon.com/wp-content/uploads/computer.png\" />\n <h1 class=\"boxtitle\">Web</h1> \n\n </div>\n </a>\n \n <a href=\"http://hub.humanapi.co/v1.1/docs/mobile-guide-ios\"> \n <div class=\"button\">\n <img class=\"boximg\" src=\"http://simpleicon.com/wp-content/uploads/iphone.png\" />\n <h1 class=\"boxtitle\">iOS</h1>\n\n </div>\n </a>\n \n <a href=\"http://hub.humanapi.co/v1.1/docs/mobile-guide-android\"> \n <div class=\"button\">\n <img class=\"boximg\" src=\"http://simpleicon.com/wp-content/uploads/android.png\" />\n <h1 class=\"boxtitle\">Android</h1>\n\n </div>\n </a>\n\n <a href=\"http://hub.humanapi.co/v1.1/docs/limited-browser-environments\"> \n <div class=\"button\">\n <img class=\"boximg\" src=\"https://crosswalk-project.org/assets/icons/logo-cordova.png\" />\n <h1 class=\"boxtitle\">Cordova</h1>\n\n </div>\n </a>\n\n</div>\n\n<style>\n h1.boxtitle{ text-align:center; font-size:2em;\t }\n \n div.button{\n float: left;\n width: 23%;\n background-color: rgba(68, 152, 212, 0.13);\n height: 160px;\n margin-left:1%;\n margin-right:1%;\n }\n \n img.boximg{\n display: block;\n \t\tmargin: 0px auto;\n height: 50%;\n padding-top: 10px;\n }\n \n \n</style>" } [/block]