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

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

问题描述

我是新来的OAuth,我试图连接到Vimeo的高级API。我对你有一对夫妇的问题,我希望他们是pretty容易解决的。

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.

第二,我已经看过...

Second, I have looked at...

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.

这里的code我迄今(可变数据是左出于安全目的):

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?

多谢,像往常一样:)

推荐答案

您应该使用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的高级API - 如何通过OAuth连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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