{"action":"created","issue":{"url":"https://api.github.com/repos/basecamp/bc3-api/issues/85","repository_url":"https://api.github.com/repos/basecamp/bc3-api","labels_url":"https://api.github.com/repos/basecamp/bc3-api/issues/85/labels{/name}","comments_url":"https://api.github.com/repos/basecamp/bc3-api/issues/85/comments","events_url":"https://api.github.com/repos/basecamp/bc3-api/issues/85/events","html_url":"https://github.com/basecamp/bc3-api/issues/85","id":202562041,"number":85,"title":"How to get new access token using Refresh Token in Basecamp API ?","user":{"login":"anupambaldi","id":9427673,"avatar_url":"https://avatars.githubusercontent.com/u/9427673?v=3","gravatar_id":"","url":"https://api.github.com/users/anupambaldi","html_url":"https://github.com/anupambaldi","followers_url":"https://api.github.com/users/anupambaldi/followers","following_url":"https://api.github.com/users/anupambaldi/following{/other_user}","gists_url":"https://api.github.com/users/anupambaldi/gists{/gist_id}","starred_url":"https://api.github.com/users/anupambaldi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anupambaldi/subscriptions","organizations_url":"https://api.github.com/users/anupambaldi/orgs","repos_url":"https://api.github.com/users/anupambaldi/repos","events_url":"https://api.github.com/users/anupambaldi/events{/privacy}","received_events_url":"https://api.github.com/users/anupambaldi/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2017-01-23T15:18:09Z","updated_at":"2017-01-31T12:09:25Z","closed_at":"2017-01-30T20:54:50Z","body":"I successfully got access token using the following endpoint -- \r\n`https://launchpad.37signals.com/authorization/new`\r\n\r\nThe complete request is --\r\n \r\n`https://launchpad.37signals.com/authorization/new?type=web_server&client_id='.$client_id.'&redirect_uri=https://www.mysite.com/basecamps/basecamp_access&state='.$user_id`.'\r\n\r\nNow, I want to refresh my access token using refresh token after completing the 14 days of expiration period. I got refresh token in response of authorization process. Below is the complete request -- \r\n`$url = \"https://launchpad.37signals.com/authorization/token\";\r\n\r\n\t\t$params = array(\r\n\t\t  \t'type' => 'refresh',\r\n\t\t\t'client_id' => $client_id,\r\n\t\t\t'client_secret' => $client_secret,\r\n\t\t\t'redirect_uri' => 'https://www.mysite.com/basecamps/basecamp_access',\r\n\t\t\t'refresh_token' => $refresh_token,\r\n\t\t);`\r\n\r\nHere is the curl -- \r\n\r\n`foreach($params as $k => $v) \r\n { \r\n\t      $postData .= $k . \"=\".$v.\"&\"; \r\n}\r\n\r\n $postData = rtrim($postData, '&');`\r\n$ch = curl_init();\r\n \r\n\t   curl_setopt($ch,CURLOPT_URL,$url);\r\n\t   curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);\r\n\t   curl_setopt($ch, CURLOPT_HTTPHEADER, array(\r\n\t\t'Content-Type:application/x-www-form-urlencoded'\r\n\t\t)); \r\n\t   curl_setopt($ch, CURLOPT_POST, count($postData));\r\n\t   curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);    \r\n\t   $output=curl_exec($ch);`\r\n\r\nI am getting code expired error everytime when I run the above code. Please tell me where I am wrong or how can I get access token using refresh token in Basecamp 3 API."},"comment":{"url":"https://api.github.com/repos/basecamp/bc3-api/issues/comments/276347276","html_url":"https://github.com/basecamp/bc3-api/issues/85#issuecomment-276347276","issue_url":"https://api.github.com/repos/basecamp/bc3-api/issues/85","id":276347276,"user":{"login":"anupambaldi","id":9427673,"avatar_url":"https://avatars.githubusercontent.com/u/9427673?v=3","gravatar_id":"","url":"https://api.github.com/users/anupambaldi","html_url":"https://github.com/anupambaldi","followers_url":"https://api.github.com/users/anupambaldi/followers","following_url":"https://api.github.com/users/anupambaldi/following{/other_user}","gists_url":"https://api.github.com/users/anupambaldi/gists{/gist_id}","starred_url":"https://api.github.com/users/anupambaldi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anupambaldi/subscriptions","organizations_url":"https://api.github.com/users/anupambaldi/orgs","repos_url":"https://api.github.com/users/anupambaldi/repos","events_url":"https://api.github.com/users/anupambaldi/events{/privacy}","received_events_url":"https://api.github.com/users/anupambaldi/received_events","type":"User","site_admin":false},"created_at":"2017-01-31T12:09:25Z","updated_at":"2017-01-31T12:09:25Z","body":"Hi Jeremy,\r\nThank you so much for the support provided by you. Everything is now sorted out. Problem was incomplete extraction of refresh token and using the same for getting new access token. Also, I will be careful about not exposing the client-secret in public, as I already didn't exposed the redirect URI but still it will be taken care.  Thank you again."}}
{"actor":{"display_login":"anupambaldi"}}