{"action":"created","comment":{"url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/pulls/comments/44470500","id":44470500,"diff_hunk":"@@ -103,9 +164,100 @@ public static String getAuthCodeFromBoxCallback(HttpServletRequest request) {\n \t\t\t\tbreak;\n \t\t\t}\n \t\t}\n+\t\t\n+\t\tif (authCode != null)\n+\t\t{\n+\t\t\t// now that we have the authCode, use it to get access token and fresh token\n+\t\t    // Returns a new access_token & refresh_token from an existing refresh_token\n+\t\t    // Each access_token is valid for 1 hour. In order to get a new, valid token, you can use the accompanying\n+\t\t    // refresh_token. Each refresh token is valid for 14 days. Every time you get a new access_token by using a\n+\t\t    // refresh_token, we reset your timer for the 14 day period. This means that as long as your users use your\n+\t\t    // application once every 14 days, their login is valid forever.\n+\t\t    // Args:\n+\t\t    //    - client_id: The client_id you obtained in the initial setup.\n+\t\t    //    - client_secret: The client_secret you obtained in the initial setup.\n+\t\t    //    - code: a string containing the code, or a dictionary containing the GET query\n+\t\t    // Returns:\n+\t\t    //    - a dictionary with the token and additional info\n+\t\t\ttry\n+\t\t\t{\n+\t\t\t\tCloseableHttpClient httpclient = HttpClients.createDefault();\n+\t\t\t\tHttpPost httpPost = new HttpPost(boxTokenUrl);\n+\t\t\t\tList <NameValuePair> nvps = new ArrayList <NameValuePair>();\n+\t\t\t\tnvps.add(new BasicNameValuePair(\"grant_type\", \"authorization_code\"));\n+\t\t\t\tnvps.add(new BasicNameValuePair(\"client_id\", boxClientId));\n+\t\t\t\tnvps.add(new BasicNameValuePair(\"client_secret\", boxClientSecret));\n+\t\t\t\tnvps.add(new BasicNameValuePair(\"code\", authCode));\n+\t\t\t\thttpPost.setEntity(new UrlEncodedFormEntity(nvps));\n+\t\t\t\tCloseableHttpResponse response = httpclient.execute(httpPost);\n+\n+\t\t\t\ttry {","path":"src/main/java/edu/umich/its/cpm/BoxUtils.java","position":161,"original_position":161,"commit_id":"f3b14daca02ee9cef2b51d27652c23dbaaca6d35","original_commit_id":"f3b14daca02ee9cef2b51d27652c23dbaaca6d35","user":{"login":"dlhaines","id":74063,"avatar_url":"https://avatars.githubusercontent.com/u/74063?v=3","gravatar_id":"","url":"https://api.github.com/users/dlhaines","html_url":"https://github.com/dlhaines","followers_url":"https://api.github.com/users/dlhaines/followers","following_url":"https://api.github.com/users/dlhaines/following{/other_user}","gists_url":"https://api.github.com/users/dlhaines/gists{/gist_id}","starred_url":"https://api.github.com/users/dlhaines/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dlhaines/subscriptions","organizations_url":"https://api.github.com/users/dlhaines/orgs","repos_url":"https://api.github.com/users/dlhaines/repos","events_url":"https://api.github.com/users/dlhaines/events{/privacy}","received_events_url":"https://api.github.com/users/dlhaines/received_events","type":"User","site_admin":false},"body":"indentation?","created_at":"2015-11-10T21:50:42Z","updated_at":"2015-11-10T21:50:42Z","html_url":"https://github.com/tl-its-umich-edu/ctools-project-migration/pull/38#discussion_r44470500","pull_request_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/pulls/38","_links":{"self":{"href":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/pulls/comments/44470500"},"html":{"href":"https://github.com/tl-its-umich-edu/ctools-project-migration/pull/38#discussion_r44470500"},"pull_request":{"href":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/pulls/38"}}},"pull_request":{"url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/pulls/38","id":50306746,"html_url":"https://github.com/tl-its-umich-edu/ctools-project-migration/pull/38","diff_url":"https://github.com/tl-its-umich-edu/ctools-project-migration/pull/38.diff","patch_url":"https://github.com/tl-its-umich-edu/ctools-project-migration/pull/38.patch","issue_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/issues/38","number":38,"state":"open","locked":false,"title":"TlCPM-105 get Box Authentication access token and refresh token","user":{"login":"zqian","id":359944,"avatar_url":"https://avatars.githubusercontent.com/u/359944?v=3","gravatar_id":"","url":"https://api.github.com/users/zqian","html_url":"https://github.com/zqian","followers_url":"https://api.github.com/users/zqian/followers","following_url":"https://api.github.com/users/zqian/following{/other_user}","gists_url":"https://api.github.com/users/zqian/gists{/gist_id}","starred_url":"https://api.github.com/users/zqian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zqian/subscriptions","organizations_url":"https://api.github.com/users/zqian/orgs","repos_url":"https://api.github.com/users/zqian/repos","events_url":"https://api.github.com/users/zqian/events{/privacy}","received_events_url":"https://api.github.com/users/zqian/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-11-10T20:30:49Z","updated_at":"2015-11-10T21:50:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a9f244f599999318945d04cb984c892c54a9f839","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/pulls/38/commits","review_comments_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/pulls/38/comments","review_comment_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/issues/38/comments","statuses_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/statuses/f3b14daca02ee9cef2b51d27652c23dbaaca6d35","head":{"label":"zqian:TLCPM-105","ref":"TLCPM-105","sha":"f3b14daca02ee9cef2b51d27652c23dbaaca6d35","user":{"login":"zqian","id":359944,"avatar_url":"https://avatars.githubusercontent.com/u/359944?v=3","gravatar_id":"","url":"https://api.github.com/users/zqian","html_url":"https://github.com/zqian","followers_url":"https://api.github.com/users/zqian/followers","following_url":"https://api.github.com/users/zqian/following{/other_user}","gists_url":"https://api.github.com/users/zqian/gists{/gist_id}","starred_url":"https://api.github.com/users/zqian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zqian/subscriptions","organizations_url":"https://api.github.com/users/zqian/orgs","repos_url":"https://api.github.com/users/zqian/repos","events_url":"https://api.github.com/users/zqian/events{/privacy}","received_events_url":"https://api.github.com/users/zqian/received_events","type":"User","site_admin":false},"repo":{"id":42910393,"name":"ctools-project-migration","full_name":"zqian/ctools-project-migration","owner":{"login":"zqian","id":359944,"avatar_url":"https://avatars.githubusercontent.com/u/359944?v=3","gravatar_id":"","url":"https://api.github.com/users/zqian","html_url":"https://github.com/zqian","followers_url":"https://api.github.com/users/zqian/followers","following_url":"https://api.github.com/users/zqian/following{/other_user}","gists_url":"https://api.github.com/users/zqian/gists{/gist_id}","starred_url":"https://api.github.com/users/zqian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zqian/subscriptions","organizations_url":"https://api.github.com/users/zqian/orgs","repos_url":"https://api.github.com/users/zqian/repos","events_url":"https://api.github.com/users/zqian/events{/privacy}","received_events_url":"https://api.github.com/users/zqian/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zqian/ctools-project-migration","description":"Project Migration","fork":true,"url":"https://api.github.com/repos/zqian/ctools-project-migration","forks_url":"https://api.github.com/repos/zqian/ctools-project-migration/forks","keys_url":"https://api.github.com/repos/zqian/ctools-project-migration/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zqian/ctools-project-migration/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zqian/ctools-project-migration/teams","hooks_url":"https://api.github.com/repos/zqian/ctools-project-migration/hooks","issue_events_url":"https://api.github.com/repos/zqian/ctools-project-migration/issues/events{/number}","events_url":"https://api.github.com/repos/zqian/ctools-project-migration/events","assignees_url":"https://api.github.com/repos/zqian/ctools-project-migration/assignees{/user}","branches_url":"https://api.github.com/repos/zqian/ctools-project-migration/branches{/branch}","tags_url":"https://api.github.com/repos/zqian/ctools-project-migration/tags","blobs_url":"https://api.github.com/repos/zqian/ctools-project-migration/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zqian/ctools-project-migration/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zqian/ctools-project-migration/git/refs{/sha}","trees_url":"https://api.github.com/repos/zqian/ctools-project-migration/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zqian/ctools-project-migration/statuses/{sha}","languages_url":"https://api.github.com/repos/zqian/ctools-project-migration/languages","stargazers_url":"https://api.github.com/repos/zqian/ctools-project-migration/stargazers","contributors_url":"https://api.github.com/repos/zqian/ctools-project-migration/contributors","subscribers_url":"https://api.github.com/repos/zqian/ctools-project-migration/subscribers","subscription_url":"https://api.github.com/repos/zqian/ctools-project-migration/subscription","commits_url":"https://api.github.com/repos/zqian/ctools-project-migration/commits{/sha}","git_commits_url":"https://api.github.com/repos/zqian/ctools-project-migration/git/commits{/sha}","comments_url":"https://api.github.com/repos/zqian/ctools-project-migration/comments{/number}","issue_comment_url":"https://api.github.com/repos/zqian/ctools-project-migration/issues/comments{/number}","contents_url":"https://api.github.com/repos/zqian/ctools-project-migration/contents/{+path}","compare_url":"https://api.github.com/repos/zqian/ctools-project-migration/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zqian/ctools-project-migration/merges","archive_url":"https://api.github.com/repos/zqian/ctools-project-migration/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zqian/ctools-project-migration/downloads","issues_url":"https://api.github.com/repos/zqian/ctools-project-migration/issues{/number}","pulls_url":"https://api.github.com/repos/zqian/ctools-project-migration/pulls{/number}","milestones_url":"https://api.github.com/repos/zqian/ctools-project-migration/milestones{/number}","notifications_url":"https://api.github.com/repos/zqian/ctools-project-migration/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zqian/ctools-project-migration/labels{/name}","releases_url":"https://api.github.com/repos/zqian/ctools-project-migration/releases{/id}","created_at":"2015-09-22T04:00:29Z","updated_at":"2015-10-29T18:06:00Z","pushed_at":"2015-11-10T20:15:21Z","git_url":"git://github.com/zqian/ctools-project-migration.git","ssh_url":"git@github.com:zqian/ctools-project-migration.git","clone_url":"https://github.com/zqian/ctools-project-migration.git","svn_url":"https://github.com/zqian/ctools-project-migration","homepage":null,"size":805,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"tl-its-umich-edu:master","ref":"master","sha":"9e37a2debd09b867b9eef3ce364f2411d4f8b01f","user":{"login":"tl-its-umich-edu","id":8292960,"avatar_url":"https://avatars.githubusercontent.com/u/8292960?v=3","gravatar_id":"","url":"https://api.github.com/users/tl-its-umich-edu","html_url":"https://github.com/tl-its-umich-edu","followers_url":"https://api.github.com/users/tl-its-umich-edu/followers","following_url":"https://api.github.com/users/tl-its-umich-edu/following{/other_user}","gists_url":"https://api.github.com/users/tl-its-umich-edu/gists{/gist_id}","starred_url":"https://api.github.com/users/tl-its-umich-edu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tl-its-umich-edu/subscriptions","organizations_url":"https://api.github.com/users/tl-its-umich-edu/orgs","repos_url":"https://api.github.com/users/tl-its-umich-edu/repos","events_url":"https://api.github.com/users/tl-its-umich-edu/events{/privacy}","received_events_url":"https://api.github.com/users/tl-its-umich-edu/received_events","type":"Organization","site_admin":false},"repo":{"id":42891532,"name":"ctools-project-migration","full_name":"tl-its-umich-edu/ctools-project-migration","owner":{"login":"tl-its-umich-edu","id":8292960,"avatar_url":"https://avatars.githubusercontent.com/u/8292960?v=3","gravatar_id":"","url":"https://api.github.com/users/tl-its-umich-edu","html_url":"https://github.com/tl-its-umich-edu","followers_url":"https://api.github.com/users/tl-its-umich-edu/followers","following_url":"https://api.github.com/users/tl-its-umich-edu/following{/other_user}","gists_url":"https://api.github.com/users/tl-its-umich-edu/gists{/gist_id}","starred_url":"https://api.github.com/users/tl-its-umich-edu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tl-its-umich-edu/subscriptions","organizations_url":"https://api.github.com/users/tl-its-umich-edu/orgs","repos_url":"https://api.github.com/users/tl-its-umich-edu/repos","events_url":"https://api.github.com/users/tl-its-umich-edu/events{/privacy}","received_events_url":"https://api.github.com/users/tl-its-umich-edu/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tl-its-umich-edu/ctools-project-migration","description":"Project Migration","fork":false,"url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration","forks_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/forks","keys_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/teams","hooks_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/hooks","issue_events_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/issues/events{/number}","events_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/events","assignees_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/assignees{/user}","branches_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/branches{/branch}","tags_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/tags","blobs_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/git/refs{/sha}","trees_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/statuses/{sha}","languages_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/languages","stargazers_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/stargazers","contributors_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/contributors","subscribers_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/subscribers","subscription_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/subscription","commits_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/commits{/sha}","git_commits_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/git/commits{/sha}","comments_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/comments{/number}","issue_comment_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/issues/comments{/number}","contents_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/contents/{+path}","compare_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/merges","archive_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/downloads","issues_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/issues{/number}","pulls_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/pulls{/number}","milestones_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/milestones{/number}","notifications_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/labels{/name}","releases_url":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/releases{/id}","created_at":"2015-09-21T20:20:08Z","updated_at":"2015-10-23T15:02:53Z","pushed_at":"2015-11-10T20:30:49Z","git_url":"git://github.com/tl-its-umich-edu/ctools-project-migration.git","ssh_url":"git@github.com:tl-its-umich-edu/ctools-project-migration.git","clone_url":"https://github.com/tl-its-umich-edu/ctools-project-migration.git","svn_url":"https://github.com/tl-its-umich-edu/ctools-project-migration","homepage":null,"size":962,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/pulls/38"},"html":{"href":"https://github.com/tl-its-umich-edu/ctools-project-migration/pull/38"},"issue":{"href":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/issues/38"},"comments":{"href":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/issues/38/comments"},"review_comments":{"href":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/pulls/38/comments"},"review_comment":{"href":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/pulls/38/commits"},"statuses":{"href":"https://api.github.com/repos/tl-its-umich-edu/ctools-project-migration/statuses/f3b14daca02ee9cef2b51d27652c23dbaaca6d35"}}}}