【问题标题】:how to acquire a google authentication token如何获取谷歌身份验证令牌
【发布时间】:2010-01-31 10:22:57
【问题描述】:

检索 URL http://www.google.com/reader/api/0/token 会返回一个令牌,该令牌会定期更新。生成此令牌需要什么?显然,我猜测 Google 会访问一个或一些 cookie 以进行身份​​验证。

这是我目前的结果:

thufir@ARRAKIS:~/projects/curl$
thufir@ARRAKIS:~/projects/curl$ ruby token.rb
<html><head><title>403 Forbidden</title>
<style type="text/css">
      body {font-family: arial,sans-serif}
      div.nav {margin-top: 1ex}
      div.nav A {font-size: 10pt; font-family: arial,sans-serif}
      span.nav {font-size: 10pt; font-family: arial,sans-serif; font-weight: bold}
      div.nav A,span.big {font-size: 12pt; color: #0000cc}
      div.nav A {font-size: 10pt; color: black}
      A.l:link {color: #6f6f6f}
      </style></head>
<body text="#000000" bgcolor="#ffffff"><table border="0" cellpadding="2" cellspacing="0" width="100%"></table>
<table><tr><td rowspan="3" width="1%"><b><font face="times" color="#0039b6" size="10">G</font><font face="times" color="#c41200" size="10">o</font><font face="times" color="#f3c518" size="10">o</font><font face="times" color="#0039b6" size="10">g</font><font face="times" color="#30a72f" size="10">l</font><font face="times" color="#c41200" size="10">e</font>&nbsp;&nbsp;</b></td>
<td>&nbsp;</td></tr>
<tr><td bgcolor="#3366cc"><font face="arial,sans-serif" color="#ffffff"><b>Error</b></font></td></tr>
<tr><td>&nbsp;</td></tr></table>
<blockquote><h1>Forbidden</h1>
Your client does not have permission to get URL <code>/reader/api/0/token</code> from this server.
<p></p></blockquote>
<table width="100%" cellpadding="0" cellspacing="0"><tr><td bgcolor="#3366cc"><img alt="" width="1" height="4"></td></tr></table></body></html>
thufir@ARRAKIS:~/projects/curl$
thufir@ARRAKIS:~/projects/curl$ nl token.rb
     1    require 'rubygems'
     2    require 'curb'

     3    token_url = "http://www.google.com/reader/api/0/token"


     4      c = Curl::Easy.perform(token_url)
     5      puts c.body_str
thufir@ARRAKIS:~/projects/curl$

【问题讨论】:

  • “我尝试在 SO 上提问,但它一直告诉我不允许发布图片!”。那就不要那样做! outpost9.com/reference/jargon/jargon_19.html#TAG494
  • 通过前缀四个空格来转义代码。粘贴包含图像标记的 HTML 响应将被视为尝试发布图像。
  • 然而,还没有图像。对我来说似乎很愚蠢。哦,好吧。

标签: ruby authentication token


【解决方案1】:

查看概述的 Google Reader API Auth here。 ClientLogin 是一种更简单的方法,但如果您想为多个用户部署 OAuth,它可能是更强大的解决方案。此外,使用 OAuth 可以让您免去处理 Google 用户凭据的麻烦,这些凭据应谨慎处理。

【讨论】:

    猜你喜欢
    • 2019-12-07
    • 2016-04-13
    • 1970-01-01
    • 2019-03-05
    • 1970-01-01
    • 1970-01-01
    • 2015-06-21
    • 1970-01-01
    • 2017-07-13
    相关资源
    最近更新 更多