【问题标题】:oauth_signature generation for Google API为 Google API 生成 oauth_signature
【发布时间】:2011-08-24 17:28:05
【问题描述】:

我正在尝试为我的网站获取用户的联系人,但我无法从 google 获取令牌,因为我收到了无效的 oauth 签名错误。谁能告诉我如何在 PHP 中为 google 生成 oauth 签名。

谢谢:)

【问题讨论】:

    标签: php oauth google-api


    【解决方案1】:

    这就是我从谷歌分析中获取数据的方式

      $curl = curl_init();
      curl_setopt($curl, CURLOPT_URL, 'https://www.google.com/accounts/ClientLogin');
      curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
      curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
      curl_setopt($curl, CURLOPT_POST, TRUE);
      $data = array(
        'accountType' => 'GOOGLE',
        'Email' => $email, //your google email
        'Passwd' => $password, //your google pass
        'service' => 'analytics',
        'source' => 'curl-accountFeed-v2'
        );
      curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
      $response = curl_exec($curl);
      $info = curl_getinfo($curl);
      curl_close($curl);
      if ($info['http_code'] == 200) {
       if ($response) {
         preg_match('/Auth=(.*)/', $response, $matches);
         if (isset($matches[1])) {
           $auth_code = $matches[1];
         }
       }
      }
    

    【讨论】:

    • 嘿,我认为它用于登录我们的 out ,但是,我需要使用 oauth 签名导入获得他们许可的用户的联系方式。如果我错了请评论
    猜你喜欢
    • 1970-01-01
    • 2011-08-24
    • 1970-01-01
    • 1970-01-01
    • 2020-03-15
    • 1970-01-01
    • 2011-11-27
    • 1970-01-01
    • 2014-09-18
    相关资源
    最近更新 更多