60

Can anyone give a help in Vimeo API using scribe? My goal is to access a private video (which I uploaded) without having to force the user to put password (this process should be done in background).

From what I understand / deduce from research is necessary:

  1. Request for application authorization using oAuth protocol and via the following link:

    https://vimeo.com/oauth/authorize?oauth_token=XXXX

    This operation is performed successfully and response data are sent to callback URL, something like:

    http://127.0.0.1:8001/XPTO.html?oauth_token=AUTH_TOKEN_EXAMPLE&oauth_verifier=VERIFIIER__EXAMPLE"

  2. According to Brad Dougherty (Vimeo API Staff) it´s possible do something like that

    If you go through the OAuth process as yourself, you can save that token and use that to make the calls.

I'm using this code:

service = new ServiceBuilder().provider(VimeoApi.class)
                .apiKey("API_KEY_EXAMPLE")
                .apiSecret("API_SECRET_EXAMPLE")
                .build();

OAuthRequest request = new OAuthRequest(Verb.GET,
        "http://vimeo.com/api/rest/v2?video_id=50305416");

request.addQuerystringParameter("format", "json");
request.addQuerystringParameter("method", "vimeo.videos.getInfo");

String oauth_verifier=VERIFIER__EXAMPLE;
Verifier verifier = new Verifier(oauth_verifier);

//I've tried differents combination to create this token
//I believe that my problem is HERE
//One unsuccessfully try: Token requestToken = service.getRequestToken();
Token requestToken = new Token(
        AUTH_TOKEN_EXAMPLE,
        API_SECRET_EXAMPLE);

Token token = service.getAccessToken(requestToken, verifier);

service.signRequest(token, request); 
Response response = request.send();

I've the following error:

Response body is incorrect. Can't extract token and secret from this: '401 Unauthorized - Invalid signature - The oauth_signature passed was not valid.'

What's escaping me? This is the correct way to do it, right?

Shayan Ghosh
  • 882
  • 6
  • 14
JMarques
  • 3,044
  • 4
  • 34
  • 55
  • 4
    You cannot create the RequestToken yourself. You *must* use `service.getRequestToken()` – Pablo Fernandez Sep 29 '12 at 15:28
  • Ok Pablo, now i can move make a request =) Can you help me with the second part of the question? I don't want that the user put the password (it´s a web app for several users)... to get the auth token (https://vimeo.com/oauth/authorize?oauth_token=XXXX) the user must be login :( how can i avoid this? And since i can't use the Simple Vimeo API for retrieve a private video (something like http://vimeo.com/api/rest/v2?video_id=50305416)... how can i get the video with advance video (i didn't a similar method =( ) Tks. – JMarques Oct 01 '12 at 10:29
  • I already solve my first question (http://stackoverflow.com/questions/12672181/vimeo-api-authorizationurl-without-login) =) The only step that separates me between heaven and hell is ... how the hell do I get a private video? – JMarques Oct 02 '12 at 09:09
  • @JMarques I am too facing the same problem. If you solve that second part somehow, than please help me too. – Arun Kumar Jul 11 '13 at 11:40
  • 2
    You can store the oauth token somewhere in your application(config file or in memory) and each time any user makes a request to see a private video - automatically send the token. This is assuming that the token Vimeo gives you at first doesn't expire. If it does expire - you can have a process run in the background that gets a new token (maybe with an account set up for the application only) and uses the new token. – TR1 Feb 13 '14 at 21:09
  • 1
    To get private videos you have to authenticate and assign read permissions. I think the parameter is x_auth_permission – davidcondrey Sep 07 '14 at 09:06

2 Answers2

1

Another way of keeping your video private is to change in the "Privacy / Settings" the option Only people with a password, to "Hide this video from Vimeo.com" and "Only on sites I choose".

The reason you might benefit from this is that you have control over the sites that can embed the video. You could even use a normal iframe embed on your app and skip the whole API call if what you want is to show your video on your site and nowhere else. But if you still need to make the call through the API, at least you don't have the password problem.

This does not answer your question directly, but is an alternative approach to solving the problem.

1cgonza
  • 1,589
  • 10
  • 20
0

First pay attention on the permission you need to pubblicate videos, so before try to autenticate them. Second think is to store everything in a memory or local storage. You can insert properties to it to start the video directly

pp94
  • 133
  • 5
  • 19