public function cmdLineAuth()
    {

        $authUrl = $this->client->createAuthUrl();
        //Request authorization
        print "Please visit:\n$authUrl\n\n";
        print "Please enter the auth code:\n";
        $authCode = trim(fgets(STDIN));
        // Exchange authorization code for access token
        $accessToken = $this->client->authenticate($authCode);

        $this->client->setAccessToken($accessToken);
        $this->accessToken = $accessToken;
        $this->refreshToken = $this->client->getRefreshToken();
    }