2015-04-23 87 views
0

我一直在试图生成身份验证令牌用于VIMEO通过Rails应用程序无法生成认证令牌的VIMEO(VIMEO集成到Rails应用程序)

response = RestClient.post "https://api.vimeo.com/oauth/authorize", 
          :response_type => "code", 
          :client_id => '2c8f2be58dcce1f61bc4f0a86dfb8d1bc214a7e0', 

          :redirect_uri => 'http://staging.tutorsweb.com', 
          :state => 'as684fad2asdflkjsadf4521s' 

上面的代码是如何我发送请求到Vimeo。

的反应是这样的:

<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <meta charset="utf-8"> 
    <title>Authentication error on Vimeo</title> 
    <meta name="viewport" content="width=device-width,maximum-scale=1.0"> 
    <meta name="robots" content="noindex,nofollow"> 
    <link rel="stylesheet" href="https://f.vimeocdn.com/styles/css_opt/auth.min.css?508754847a"> 
    <link rel="apple-touch-icon-precomposed" media="(resolution: 326dpi)" href="https://f.vimeocdn.com/images_v6/apple-touch-icon-114.png"> 
    <link rel="apple-touch-icon-precomposed" media="(resolution: 163dpi)" href="https://f.vimeocdn.com/images_v6/apple-touch-icon-57.png"> 
    <link rel="apple-touch-icon-precomposed" media="(resolution: 132dpi)" href="https://f.vimeocdn.com/images_v6/apple-touch-icon-72.png"> 
</head> 
<body> 
<div id="authorization"> 
    <header class="page"> 
       <div id="logo"> 
      <a href="//vimeo.com" title="Go home"> 
       <img class="svg" src="https://f.vimeocdn.com/logo.svg" alt="Go home" width="140" height="40"> 
      </a> 
     </div> 
    </header> 

    <section class="content"> 
     <div id="security" style="display:none"> 
      <script>if(self==top){document.getElementById("security").style.display="block"}else{top.location=self.location}</script> 
      <h3 class="hot">Uh oh, something went wrong!</h3> 

<p>An error has occurred. You won't be able to connect to Vimeo until it is fixed by the developer.</p> 

    <p>Hm. We're not sure what you're trying to do. Please contact the service you want to connect to Vimeo, and tell them,</p> 

    <p>"We were unable to provide your user an oauth2 authorization code because the redirect URI or client ID were missing."</p> 

<p><a class="btn btn_gray" onclick="window.history.back();return false">Go back</a></p> 
     </div> 
     <noscript> 
      <h3 class="hot">JavaScript Required</h3> 
      <p>In order to protect your Vimeo account from unauthorized access, this page requires JavaScript.</p> 
     </noscript> 
    </section> 

    <footer> 
     You can change any application access preferences from your <a href="//vimeo.com/settings/extend">settings page</a>.   </footer> 
</div> 
<script>var token=document.getElementById('token');if(token){document.cookie='xsrft=' + token.value}</script> 
</body> 
</html> 

,我一直在关注https://github.com/matthooks/vimeo/tree/master我试图matthooks还,但它并没有为我工作。

请指教我该怎么做? 以及我如何通过示例为我的rails应用程序生成vimeo的身份验证令牌

回答

0

通过matthooks的VIMEO宝石仍然使用旧的简单和Vimeo的高级API。那些不再被支持,虽然端点仍然在和功能; Vimeo一直在推动用户版本3.x.

对于您正在尝试执行的操作,您可能会发现API Specification 可能会有所帮助。这将允许您将您的呼叫绑定到特定版本的API。再加上API Authentication Specification,你应该有你需要的信息来制作你的请求。

使用curl作为测试平台,非认证用户可以很简单的:

curl -H "Authorization: Bearer <OAUTH_TOKEN>" https://api.vimeo.com 

祝你好运!