Vimeo 高级 API - 如何通过 Oauth 连接?
我是 oauth 新手,我正在尝试连接到 Vimeo Advanced API。我有几个问题要问你,希望它们很容易解决。
首先,使用oauth连接会出现提示还是可以静默?我正在尝试从私人视频中获取信息,而 vimeo 告诉我需要 oauth 身份验证才能执行此操作。
其次,我查看了...
http://vimeo.com/api/docs/oauth
而且...
http://vimeo.com/api/docs/authentication
我创建了基于指令的基本字符串oauth 指南,但我现在不知道该怎么办。
这是我到目前为止的代码(出于安全目的,省略了可变数据):
$http_request_string = "method=" . $oauth_method . "&oauth_consumer_key=" . $oauth_key . "&oauth_nonce=" . $oauth_nonce . "&oauth_signature_method=" . $oauth_signature_method . "&oauth_timestamp=" . $oauth_timestamp . "&oauth_version=" . $oauth_version . "&user_id=" . $oauth_user_id;
$base_string = $oauth_method . "&" . urlencode($oauth_method) . "&" . urlencode($http_request_string);
$key = $oauth_key . "&" . $oauth_secret;
有人可以向我提供建议或指南,让我知道如何通过 PHP 连接吗?或者让我知道如果没有提示就无法执行此操作?
非常感谢,一如既往:)
I'm new to oauth and I'm trying to connect to the Vimeo Advanced API. I have a couple questions for you, and I hope they are pretty easy to resolve.
First, will connecting using oauth cause a prompt or can it be silent? I'm trying to get info from private videos and vimeo is telling me I need oauth authentication to do so.
Second, I have looked at...
http://vimeo.com/api/docs/oauth
And...
http://vimeo.com/api/docs/authentication
I have created the base string based on the instructions in the oauth guide, but I don't know what to do now that I have it.
Here's the code I have so far (variable data is left out for security purposes):
$http_request_string = "method=" . $oauth_method . "&oauth_consumer_key=" . $oauth_key . "&oauth_nonce=" . $oauth_nonce . "&oauth_signature_method=" . $oauth_signature_method . "&oauth_timestamp=" . $oauth_timestamp . "&oauth_version=" . $oauth_version . "&user_id=" . $oauth_user_id;
$base_string = $oauth_method . "&" . urlencode($oauth_method) . "&" . urlencode($http_request_string);
$key = $oauth_key . "&" . $oauth_secret;
Could someone please provide me with advice or a guide by which I know how to connect via PHP? Or let me know if it's not possible to do so without a prompt?
Thanks a bunch, like always :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该使用 OAuth 客户端库,它会为您完成所有这些工作。
如果你真的不能:
你需要用密钥签署base_string:
然后你必须在你的请求中发送一个授权标头:
You should use an OAuth client library, it would do all of this for you.
If you really can't:
You need to sign the base_string with the key:
Then you have to send an Authorization header with your request: