{"__v":8,"_id":"564d1afc4567342100ad96cb","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":"5539912a0074c80d00621b14","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":["58882d2949ccfc1b00257d33"],"next":{"pages":[],"description":""},"createdAt":"2015-05-11T21:22:46.375Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":3,"body":"This page will help you get started with Human API for Android. You'll be up and running in no time! If you haven't already, please create a developer account as described on the [Start Here](doc:start-here) page and come back here when you're done. \n\n#Overview\nAs described in [Start Here](doc:start-here), there are two main parts to integrating Human API with your application:\n* **A:** Authentication: Allowing your users to authenticate their data\n* **B:** Data Retrieval: Accessing authenticated user data\n\nThis guide will walk through the implementation of the Human API Android SDK to handle **part A** by allowing your users to authenticate their data within your application via the Human Connect popup . After the authentication process is complete, you will have the credentials needed to access user data from your server to complete **part B** as detailed in the [Data Retrieval](doc:data-overview) section of the documentation.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/S8gOyGKQT1aV3zP9mycQ_kannnect-android.png\",\n        \"kannnect-android.png\",\n        \"902\",\n        \"1532\",\n        \"#434ce2\",\n        \"\"\n      ],\n      \"caption\": \"Connect on Android\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Add the SDK to your Application\"\n}\n[/block]\nThe HumanAPI Android SDK consists of one package `co.humanapi.connectsdk`, which is browser-based UI to handle the launch and callback functions of Human Connect.\n\n#Import SDK module for Android Studio \n* Clone the [SDK](https://github.com/humanapi/humanapi-android-client) with `$ git clone https://github.com/humanapi/humanapi-android-client`\n* Copy the `humanapi-sdk` folder into your project's \"app\" folder\n* Import `humanapi-sdk` as a module for your application\n * Go to File -> New -> Import Module -> Source Directory -> Browse the project path for `humanapi-sdk`\n * Specify the Module Name as `:humanapi-sdk` in the dialog box\n * Let Android Studio build the project.\n * Open `build.gradle (Module:app)` file and add the following line in the dependencies block:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"compile project(':humanapi-sdk')\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\n*  Press the “sync now” link to start a sync of gradle files\n\n#Add Android Permissions \nIf you don't have it already, be sure to add `android.permission.INTERNET` to your application's `AndroidManifest.xml` so that the SDK can access the internet.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<!--Add to app AndroidManifest.xml file within the <manifest> but outside <application> tags-->\\n<uses-permission android:name=\\\"android.permission.INTERNET\\\" />\",\n      \"language\": \"xml\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Configure and Launch Human Connect\"\n}\n[/block]\nNow that you have installed the SDK, it's time to set up the authentication flow.\n\nA user authenticates Human API by clicking the Connect Health Data button and authenticating their data directly with your application via Human Connect.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/Ux0rUeXTRoup2PJ7oY4L_blue.png\",\n        \"blue.png\",\n        \"259\",\n        \"49\",\n        \"#4184c4\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nYou can easily embed this authentication process directly into your Android application. \n\nFirst, add the button above (or another button of your choosing) to the Activity you would like to launch Connect from. Next, connect this button to a function (we'll use `onConnect()`) to launch Human Connect in three steps:\n\n\n#1. Create an Intent for Human Connect\nUse the code below to create an Intent for Human Connect targeting the ConnectActivity class in the SDK:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"  Intent intent = new Intent(this, co.humanapi.connectsdk.ConnectActivity.class);\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\n#2. Add Configuration Options to the Intent\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"\\tBundle b = new Bundle();\\n\\n  b.putString(\\\"client_id\\\", \\\"659e9bd58ec4ee7fa01bc6b4627cb37e5c13ec21\\\");\\n  b.putString(\\\"auth_url\\\", \\\"http://10.0.2.2:3000/sessionToken\\\");\\n  b.putString(\\\"client_user_id\\\", \\\"test_user21:::at:::gmail.com\\\");\\n  b.putString(\\\"language\\\", \\\"en\\\");\\n\\n  //PublicToken (mandatory for existing users)\\n  //b.putString(\\\"public_token\\\", \\\"e56fa0350866bcf266da442cb974d84e\\\");\\n  intent.putExtras(b);\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\nHuman Connect needs to be passed a few values for it to load correctly. These values are:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Property\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"`client_id`\",\n    \"1-0\": \"`auth_url`\",\n    \"2-0\": \"`client_user_id`\",\n    \"3-0\": \"`language` (optional)\",\n    \"3-1\": \"Localization option. See all possilbe values [here](http://hub.humanapi.co/docs/customizing-human-connect#localization).\",\n    \"0-1\": \"Unique ID of your developer portal application (found on the application settings page).\",\n    \"1-1\": \"Custom endpoint on your server to handle the user token exchange.\\n(You can add the default for now, we'll be implementing this in the second half of this guide.)\",\n    \"2-1\": \"Unique ID of the user in your system. This will be returned in the final step so that you can associate Human API credentials with the correct user.\",\n    \"4-0\": \"`public_token`\",\n    \"4-1\": \"Token used when launching Connect for existing users. You'll get this token after the first successful authentication, so it's okay to leave it out for now.\"\n  },\n  \"cols\": 2,\n  \"rows\": 5\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"PublicToken\",\n  \"body\": \"You will receive a `publicToken` at the end of the user authentication process. This value must be passed into Human Connect every time the user opens the popup thereafter. It is not necessary for the first launch.\"\n}\n[/block]\n#3. Launch the Activity for Human Connect  \n\nFinally, use `startActivityForResult` to launch the Activity for Human Connect with the Intent and Bundle created above:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \" \\tstartActivityForResult(intent, HUMANAPI_AUTH);\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\n#Complete Launch Implementation\nAltogether, your launch code for Human Connect should now look something like this:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"static final int HUMANAPI_AUTH = 1;\\n\\npublic void onConnect(View view) {\\n  \\n  /* 1. Create an Intent for Human Connect */\\n  Intent intent = new Intent(this, co.humanapi.connectsdk.ConnectActivity.class);\\n  \\n\\t\\n  /* 2. Add Bundle with configuration options */\\n  Bundle b = new Bundle();\\n\\n  b.putString(\\\"client_id\\\", \\\"659e9bd58ec4ee7fa01bc6b4627cb37e5c13ec21\\\");\\n  b.putString(\\\"auth_url\\\", \\\"http://10.0.2.2:3000/sessionToken\\\");\\n  b.putString(\\\"client_user_id\\\", \\\"test_user21@gmail.com\\\");\\n  b.putString(\\\"language\\\", \\\"en\\\");\\n\\n  //PublicToken (mandatory for existing users)\\n  //b.putString(\\\"public_token\\\", \\\"e56fa0350866bcf266da442cb974d84e\\\");\\n  intent.putExtras(b);\\n  \\n  /* 3. Launch Human Connect Activity */\\n  startActivityForResult(intent, 2);\\n \\n}\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\nThat is all that is needed to correctly launch Human Connect to allow your users to authenticate their data. The second half of the authentication process will occur on your server at the `auth_url` endpoint.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"[Server-Side] Handle Token Exchange\"\n}\n[/block]\nWhen a user authenticates a new data source in Human Connect, the Connect SDK will POST a `sessionTokenObject` to your server for final processing via the `auth_url` specified on launch.\n\nTo complete the token exchange process, you should:\n   1. Add your `clientSecret` to the `sessionTokenObject` \n     (clientSecret can be found on the app settings page in the developer portal)\n    \n   2. POST the modified `sessionTokenObject` from your server to Human API Tokens Endpoint:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"   https://user.humanapi.co/v1/connect/tokens\",\n      \"language\": \"curl\"\n    }\n  ]\n}\n[/block]\n   3. Retrieve and store `humanId`, `accessToken` and `publicToken` on your server with the user model to be used to query user data from Human API. \n     ([See here](http://hub.humanapi.co/docs/overview-of-human-connect#key-data-points) for more information on what these values are.)\n    \n   4. Return status `200 OK` with payload containing `publicToken` to store on device for future launches of Human Connect:   \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"   { publicToken: \\\"2767d6oea95f4c3db8e8f3d0a1238302\\\" }\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n Here's an example of what this endpoint might look like in Node.js:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"//Endpoint for specified 'authURL'\\napp.post('/sessionToken', function(req, res, next) {\\n\\n  var sessionTokenObject = req.body;\\n  // grab client secret from app settings page and `sign` `sessionTokenObject` with it.\\n  sessionTokenObject.clientSecret = '<Your-Client-Secret>';\\n\\n  request({\\n    method: 'POST',\\n    uri: 'https://user.humanapi.co/v1/connect/tokens',\\n    json: sessionTokenObject\\n  }, function(err, resp, body) {\\n      if(err) return res.send(422);\\n\\n       //Use these values to determine which user launched Connect\\n      console.log(\\\"clientId =\\\"+ body.clientId);\\n      console.log(\\\"clientId =\\\"+ body.clientId);\\n\\n      /* Human API credentials. \\n      Save these with the user model in your system. */\\n      console.log(\\\"humanId = \\\" + body.humanId);\\n      console.log(\\\"accessToken = \\\"+ body.accessToken);\\n      console.log(\\\"publicToken = \\\"+ body.publicToken);\\n\\n\\n      //Send back publicToken to Android app\\n      var responseJSON = {publicToken: body.publicToken};\\n\\n      res.setHeader('Content-Type', 'application/json');\\n      res.status(201).send(JSON.stringify(responseJSON));\\n    });\\n});\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n\nFor more information on the server implementation, see the detailed guide: [Finalizing User Authentication](doc:finalizing-user-authentication).\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Handle Callbacks from Human Connect\"\n}\n[/block]\nWhen the token exchange process is complete on your server, the Human API SDK will deliver your response to `onActivityResult` under the `RESULT_OK` result code.\n\nHere, you should save the returned `publicToken` on the device so that you can supply it in the Intent whenever the user launches Connect again in the future.\n\n`RESULT_CANCELED` occurs when the user closes the Connect window without authenticating a source. In this case, nothing is sent to the specified `auth_url` so there aren't any tokens or user data to retrieve. Implementation of this callback is this therefore optional.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"/** Called when result returned */\\n@Override\\nprotected void onActivityResult(int requestCode, int resultCode, Intent data) {\\n    if (requestCode != HUMANAPI_AUTH) {\\n        return; // incorrect code\\n    }\\n    if (resultCode == RESULT_OK) {\\n        Log.d(\\\"hapi-home\\\", \\\"Authorization workflow completed\\\");\\n        Bundle b = data.getExtras();\\n        Log.d(\\\"hapi-home\\\", \\\".. public_token=\\\" + b.getString(\\\"public_token\\\"));\\n\\n\\n    } else if (resultCode == RESULT_CANCELED) {\\n        Log.d(\\\"hapi-home\\\", \\\"Authorization workflow cancelled\\\");\\n    }\\n}\\n\",\n      \"language\": \"java\",\n      \"name\": \"Java\"\n    }\n  ]\n}\n[/block]\nThat's it! Now that you have the user's `humanId` and `accessToken`, you can start querying their data on your server for display in your app.\n\nSee the documentation in the [Data Retrieval](doc:data-overview) section of the documentation for more information.","excerpt":"How to use Human API to get health data easily from your mobile app","slug":"mobile-guide-android","type":"basic","title":"Android Guide"}

Android Guide

How to use Human API to get health data easily from your mobile app

This page will help you get started with Human API for Android. You'll be up and running in no time! If you haven't already, please create a developer account as described on the [Start Here](doc:start-here) page and come back here when you're done. #Overview As described in [Start Here](doc:start-here), there are two main parts to integrating Human API with your application: * **A:** Authentication: Allowing your users to authenticate their data * **B:** Data Retrieval: Accessing authenticated user data This guide will walk through the implementation of the Human API Android SDK to handle **part A** by allowing your users to authenticate their data within your application via the Human Connect popup . After the authentication process is complete, you will have the credentials needed to access user data from your server to complete **part B** as detailed in the [Data Retrieval](doc:data-overview) section of the documentation. [block:image] { "images": [ { "image": [ "https://files.readme.io/S8gOyGKQT1aV3zP9mycQ_kannnect-android.png", "kannnect-android.png", "902", "1532", "#434ce2", "" ], "caption": "Connect on Android" } ] } [/block] [block:api-header] { "type": "basic", "title": "Add the SDK to your Application" } [/block] The HumanAPI Android SDK consists of one package `co.humanapi.connectsdk`, which is browser-based UI to handle the launch and callback functions of Human Connect. #Import SDK module for Android Studio * Clone the [SDK](https://github.com/humanapi/humanapi-android-client) with `$ git clone https://github.com/humanapi/humanapi-android-client` * Copy the `humanapi-sdk` folder into your project's "app" folder * Import `humanapi-sdk` as a module for your application * Go to File -> New -> Import Module -> Source Directory -> Browse the project path for `humanapi-sdk` * Specify the Module Name as `:humanapi-sdk` in the dialog box * Let Android Studio build the project. * Open `build.gradle (Module:app)` file and add the following line in the dependencies block: [block:code] { "codes": [ { "code": "compile project(':humanapi-sdk')", "language": "text" } ] } [/block] * Press the “sync now” link to start a sync of gradle files #Add Android Permissions If you don't have it already, be sure to add `android.permission.INTERNET` to your application's `AndroidManifest.xml` so that the SDK can access the internet. [block:code] { "codes": [ { "code": "<!--Add to app AndroidManifest.xml file within the <manifest> but outside <application> tags-->\n<uses-permission android:name=\"android.permission.INTERNET\" />", "language": "xml" } ] } [/block] [block:api-header] { "type": "basic", "title": "Configure and Launch Human Connect" } [/block] Now that you have installed the SDK, it's time to set up the authentication flow. A user authenticates Human API by clicking the Connect Health Data button and authenticating their data directly with your application via Human Connect. [block:image] { "images": [ { "image": [ "https://files.readme.io/Ux0rUeXTRoup2PJ7oY4L_blue.png", "blue.png", "259", "49", "#4184c4", "" ] } ] } [/block] You can easily embed this authentication process directly into your Android application. First, add the button above (or another button of your choosing) to the Activity you would like to launch Connect from. Next, connect this button to a function (we'll use `onConnect()`) to launch Human Connect in three steps: #1. Create an Intent for Human Connect Use the code below to create an Intent for Human Connect targeting the ConnectActivity class in the SDK: [block:code] { "codes": [ { "code": " Intent intent = new Intent(this, co.humanapi.connectsdk.ConnectActivity.class);", "language": "java" } ] } [/block] #2. Add Configuration Options to the Intent [block:code] { "codes": [ { "code": "\tBundle b = new Bundle();\n\n b.putString(\"client_id\", \"659e9bd58ec4ee7fa01bc6b4627cb37e5c13ec21\");\n b.putString(\"auth_url\", \"http://10.0.2.2:3000/sessionToken\");\n b.putString(\"client_user_id\", \"test_user21@gmail.com\");\n b.putString(\"language\", \"en\");\n\n //PublicToken (mandatory for existing users)\n //b.putString(\"public_token\", \"e56fa0350866bcf266da442cb974d84e\");\n intent.putExtras(b);", "language": "java" } ] } [/block] Human Connect needs to be passed a few values for it to load correctly. These values are: [block:parameters] { "data": { "h-0": "Property", "h-1": "Description", "0-0": "`client_id`", "1-0": "`auth_url`", "2-0": "`client_user_id`", "3-0": "`language` (optional)", "3-1": "Localization option. See all possilbe values [here](http://hub.humanapi.co/docs/customizing-human-connect#localization).", "0-1": "Unique ID of your developer portal application (found on the application settings page).", "1-1": "Custom endpoint on your server to handle the user token exchange.\n(You can add the default for now, we'll be implementing this in the second half of this guide.)", "2-1": "Unique ID of the user in your system. This will be returned in the final step so that you can associate Human API credentials with the correct user.", "4-0": "`public_token`", "4-1": "Token used when launching Connect for existing users. You'll get this token after the first successful authentication, so it's okay to leave it out for now." }, "cols": 2, "rows": 5 } [/block] [block:callout] { "type": "warning", "title": "PublicToken", "body": "You will receive a `publicToken` at the end of the user authentication process. This value must be passed into Human Connect every time the user opens the popup thereafter. It is not necessary for the first launch." } [/block] #3. Launch the Activity for Human Connect Finally, use `startActivityForResult` to launch the Activity for Human Connect with the Intent and Bundle created above: [block:code] { "codes": [ { "code": " \tstartActivityForResult(intent, HUMANAPI_AUTH);", "language": "java" } ] } [/block] #Complete Launch Implementation Altogether, your launch code for Human Connect should now look something like this: [block:code] { "codes": [ { "code": "static final int HUMANAPI_AUTH = 1;\n\npublic void onConnect(View view) {\n \n /* 1. Create an Intent for Human Connect */\n Intent intent = new Intent(this, co.humanapi.connectsdk.ConnectActivity.class);\n \n\t\n /* 2. Add Bundle with configuration options */\n Bundle b = new Bundle();\n\n b.putString(\"client_id\", \"659e9bd58ec4ee7fa01bc6b4627cb37e5c13ec21\");\n b.putString(\"auth_url\", \"http://10.0.2.2:3000/sessionToken\");\n b.putString(\"client_user_id\", \"test_user21@gmail.com\");\n b.putString(\"language\", \"en\");\n\n //PublicToken (mandatory for existing users)\n //b.putString(\"public_token\", \"e56fa0350866bcf266da442cb974d84e\");\n intent.putExtras(b);\n \n /* 3. Launch Human Connect Activity */\n startActivityForResult(intent, 2);\n \n}", "language": "java" } ] } [/block] That is all that is needed to correctly launch Human Connect to allow your users to authenticate their data. The second half of the authentication process will occur on your server at the `auth_url` endpoint. [block:api-header] { "type": "basic", "title": "[Server-Side] Handle Token Exchange" } [/block] When a user authenticates a new data source in Human Connect, the Connect SDK will POST a `sessionTokenObject` to your server for final processing via the `auth_url` specified on launch. To complete the token exchange process, you should: 1. Add your `clientSecret` to the `sessionTokenObject` (clientSecret can be found on the app settings page in the developer portal) 2. POST the modified `sessionTokenObject` from your server to Human API Tokens Endpoint: [block:code] { "codes": [ { "code": " https://user.humanapi.co/v1/connect/tokens", "language": "curl" } ] } [/block] 3. Retrieve and store `humanId`, `accessToken` and `publicToken` on your server with the user model to be used to query user data from Human API. ([See here](http://hub.humanapi.co/docs/overview-of-human-connect#key-data-points) for more information on what these values are.) 4. Return status `200 OK` with payload containing `publicToken` to store on device for future launches of Human Connect: [block:code] { "codes": [ { "code": " { publicToken: \"2767d6oea95f4c3db8e8f3d0a1238302\" }", "language": "javascript" } ] } [/block] Here's an example of what this endpoint might look like in Node.js: [block:code] { "codes": [ { "code": "//Endpoint for specified 'authURL'\napp.post('/sessionToken', function(req, res, next) {\n\n var sessionTokenObject = req.body;\n // grab client secret from app settings page and `sign` `sessionTokenObject` with it.\n sessionTokenObject.clientSecret = '<Your-Client-Secret>';\n\n request({\n method: 'POST',\n uri: 'https://user.humanapi.co/v1/connect/tokens',\n json: sessionTokenObject\n }, function(err, resp, body) {\n if(err) return res.send(422);\n\n //Use these values to determine which user launched Connect\n console.log(\"clientId =\"+ body.clientId);\n console.log(\"clientId =\"+ body.clientId);\n\n /* Human API credentials. \n Save these with the user model in your system. */\n console.log(\"humanId = \" + body.humanId);\n console.log(\"accessToken = \"+ body.accessToken);\n console.log(\"publicToken = \"+ body.publicToken);\n\n\n //Send back publicToken to Android app\n var responseJSON = {publicToken: body.publicToken};\n\n res.setHeader('Content-Type', 'application/json');\n res.status(201).send(JSON.stringify(responseJSON));\n });\n});", "language": "javascript" } ] } [/block] For more information on the server implementation, see the detailed guide: [Finalizing User Authentication](doc:finalizing-user-authentication). [block:api-header] { "type": "basic", "title": "Handle Callbacks from Human Connect" } [/block] When the token exchange process is complete on your server, the Human API SDK will deliver your response to `onActivityResult` under the `RESULT_OK` result code. Here, you should save the returned `publicToken` on the device so that you can supply it in the Intent whenever the user launches Connect again in the future. `RESULT_CANCELED` occurs when the user closes the Connect window without authenticating a source. In this case, nothing is sent to the specified `auth_url` so there aren't any tokens or user data to retrieve. Implementation of this callback is this therefore optional. [block:code] { "codes": [ { "code": "/** Called when result returned */\n@Override\nprotected void onActivityResult(int requestCode, int resultCode, Intent data) {\n if (requestCode != HUMANAPI_AUTH) {\n return; // incorrect code\n }\n if (resultCode == RESULT_OK) {\n Log.d(\"hapi-home\", \"Authorization workflow completed\");\n Bundle b = data.getExtras();\n Log.d(\"hapi-home\", \".. public_token=\" + b.getString(\"public_token\"));\n\n\n } else if (resultCode == RESULT_CANCELED) {\n Log.d(\"hapi-home\", \"Authorization workflow cancelled\");\n }\n}\n", "language": "java", "name": "Java" } ] } [/block] That's it! Now that you have the user's `humanId` and `accessToken`, you can start querying their data on your server for display in your app. See the documentation in the [Data Retrieval](doc:data-overview) section of the documentation for more information.