PHP Google YouTube API Authentication
===

I am using Google Data PHP API. I follow https://developers.google.com/youtube/2.0/developers_guide_php#AuthSub_for_Web_Applications , expect that I keep a refresh token, and send a request to get the access token. The refresh token is for the user who owns the video (I have done this using Java). But at the end I still cannot be authenticated. What's wrong here? The code is as follows.

    $refreshToken = '1/wY9.......';
    $postString = 'client_id=' . $_SESSION['clientId'] .
            '&client_secret=' . $_SESSION['clientSecret'] . 
            '&refresh_token=' . $refreshToken .
            '&grant_type=refresh_token';

    $ch = curl_init($_SESSION['oauth2Url']);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);
    $result = curl_exec($ch);
    curl_close($ch);

    $json = json_decode($result);
    $accessToken = $json->access_token;

    $httpClient = Zend_Gdata_AuthSub::getHttpClient($accessToken);

    $yt = new Zend_Gdata_YouTube($httpClient, null, $_SESSION['clientId'], $_SESSION['developerKey']);
    $yt->setMajorProtocolVersion(2);

    $youtubeId = 'xxxxxxxxxxx';
    
    $videoEntry = $yt->getVideoEntry($youtubeId);
    if ($videoEntry->getEditLink() !== null) {
        echo 'can edit!';
    } else {
        echo 'cannot edit!';
    }