Vimeo Advanced API - 如何通过 Oauth 连接? [英] Vimeo Advanced API - How to connect via Oauth?

查看:46
本文介绍了Vimeo Advanced API - 如何通过 Oauth 连接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 oauth 的新手,我正在尝试连接到 Vimeo Advanced API.我有几个问题要问你,我希望它们很容易解决.

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.

首先,使用 oauth 连接会导致提示还是可以静音?我正在尝试从私人视频中获取信息,但 vimeo 告诉我我需要 oauth 身份验证才能这样做.

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.

其次,我看过...

http://vimeo.com/api/docs/oauth

还有……

http://vimeo.com/api/docs/authentication

我已经根据 oauth 指南中的说明创建了基本字符串,但是现在我不知道该怎么做.

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;

有人可以向我提供建议或指南,让我知道如何通过 PHP 进行连接吗?或者如果没有提示就无法这样做,请告诉我?

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 :)

推荐答案

您应该使用 OAuth 客户端库,它会为您完成所有这些工作.

You should use an OAuth client library, it would do all of this for you.

如果你真的做不到:

您需要使用密钥对 base_string 进行签名:

You need to sign the base_string with the key:

$signature = hash_hmac('SHA1', $base_string, $key, true);

然后你必须在你的请求中发送一个 Authorization 标头:

Then you have to send an Authorization header with your request:

Authorization: OAuth realm="",
oauth_callback="oob",
oauth_consumer_key="YourConsumerKey",
oauth_signature_method="HMAC-SHA1",
oauth_timestamp="1234567890",
oauth_nonce="abcdefghijk",
oauth_version="1.0",
oauth_signature="YourSignature" 

这篇关于Vimeo Advanced API - 如何通过 Oauth 连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆