开发者

Vimeo Advanced API - How to connect via Oauth?

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;
开发者_如何学Python

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


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:

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

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" 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜