使用OAuth 2.0访问Google api(特别是Blogger) (PHP)


Using OAuth 2.0 to Access Google APIs (Specifically Blogger) (PHP)

使用Google的教程,我尝试使用OAuth 2.0身份验证方法访问Blogger API。我已经成功地通过了OAuth的身份验证,但我不明白如何访问API。

他们所有的例子都运行对象$gdclient -如果你使用AuthSub方法,它被设置为Zend_Gdata_AuthSub::getHttpClient($_SESSION['sessionToken']);

但是,如果您使用OAuth2.0进行身份验证,我似乎找不到设置$gdclient的内容!请帮忙好吗?其余的例子都很简单,但正如我提到的,它们都运行在$gdclient上,到目前为止我还无法设置。

Blogger API教程:http://code.google.com/apis/blogger/docs/1.0/developers_guide_php.html

OAuth 2.0: http://code.google.com/apis/accounts/docs/OAuth2.html

谢谢!

形成标题:3.c。ClientLogin用户名密码鉴权

$user = 'user@example.com';
$pass = 'secretPasswd';
$service = 'blogger';
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service, null,
    Zend_Gdata_ClientLogin::DEFAULT_SOURCE, null, null,
    Zend_Gdata_ClientLogin::CLIENTLOGIN_URI, 'GOOGLE');
$gdClient = new Zend_Gdata($client);