我一直在尝试通过rails应用程序为vimeo生成身份验证令牌
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的身份验证令牌
第一步是为您的客户。您应该构建此链接并通过浏览器发送它们。
如果您只需要自己的访问令牌,则可以在developer site的应用页面上生成它
您还可以在Vimeo's authentication documentation中阅读更多内容
matthooks的vimeo gem仍然使用Vimeo的旧的Simple和Advanced API。虽然终点仍然存在并且功能正常,但不再支持这些; Vimeo一直在推动用户使用3.x版。
对于你想要做的事情,你可能会发现API Specification可能会有所帮助。这样您就可以将调用绑定到特定版本的API。结合API Authentication Specification,你应该有你需要的信息来制定你的要求。
使用curl作为测试平台,非用户身份验证可以像下面这样简单:
curl -H "Authorization: Bearer <OAUTH_TOKEN>" https://api.vimeo.com
祝好运!