2015-04-23 88 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 

祝你好運!