View Vimeo private video with an OAuth token

JavaOauthVimeoHttp Status-Code-401Scribe

Java Problem Overview


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"

  1. 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?

Java Solutions


Solution 1 - Java

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.

Solution 2 - Java

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJMarquesView Question on Stackoverflow
Solution 1 - Java1cgonzaView Answer on Stackoverflow
Solution 2 - Javapp94View Answer on Stackoverflow