用于公共搜索的YouTube Data API身份验证(Ruby)

时间:2016-04-11 16:54:31

标签: ruby youtube-data-api google-api-ruby-client

我们的YouTube集成突然停止工作[1],所以我开始移植到google-api-client gem版本0.9,但是如果没有对用户进行身份验证,我找不到搜索方法。我只想做公开搜索。这不可能了吗?所有样本仍使用gem的v0.8,这基本上是一个完全不同的库。

我尝试了什么:

youtube = Google::Apis::YoutubeV3::YouTubeService.new
youtube.authorization = Signet::OAuth2::Client.new(
    client_id:     CLIENT_ID,
    client_secret: CLIENT_SECRET,
    token_credential_uri: 'https://www.googleapis.com/oauth2/v3/token',
    authorization_uri:    'https://accounts.google.com/o/oauth2/auth')
youtube.authorization.grant_type = 'client_credentials'
res = youtube.list_searches(:snippet, q: q, type: 'video')

结果是:

  

缺少授权码。

[1]旧代码现在总是这样说,但为什么引用服务器< - >服务器API调用?我没有看到配置IP的表单。

  

您的API密钥上配置了每IP或每个Referer限制,并且请求与这些限制不匹配。如果允许来自此IP或引用者的请求,请使用Google Developers Console更新您的API密钥配置。

0 个答案:

没有答案
相关问题