I get asana access token and refresh token and save it in my database.
$client = Asana\Client::oauth(array(
‘client_id’ => $config[‘client_id’],
‘client_secret’ => $config[‘client_secret’],
‘redirect_uri’ => $this->getRedirectUri(),
));
$access_token = $client->dispatcher->fetchToken($access_token);
$token = $client->dispatcher->refreshAccessToken();
and then I use below code for get tasks from api. after 1hour time I get access token is not set error.
$client = Asana\Client::oauth(array(
‘client_id’ =>$config[‘client_id’],
‘client_secret’ => $config[‘client_secret’],
‘redirect_uri’ => $this->getRedirectUri(),
‘token’ => $token[‘access_token’],
‘refresh_token’ => $token[‘refresh_token’]
));
$result = $client->get("/projects/{$projectId}/tasks?opt_fields=modified_at,name,notes&limit=1", []);