Vimeo API AuthorizationUrl Without Login

2019-04-14 23:48发布

问题:

I'm using Vimeo API to get video on a web application context and i have a simple question (i hope :P )

It´s possible to do a request for application authorization using oAuth protocol and via the following link: https://vimeo.com/oauth/authorize?oauth_token=XXXX, WITHOUT force the user to login in browser?

I noticed that if I'm not logged on Vimeo, when I go to https://vimeo.com/oauth/authorize?oauth_token=XXXX, Vimeo redirects me to the login page...

Thanks.

回答1:

I found it =)

You can create the access token using the application credentials or using the login data. In this case you don't have to make a authorize call.

Example (taken from comments):

String vimeoAPIURL = "vimeo.com/api/rest/v2?video_id=213";
OAuthRequest request = new OAuthRequest(Verb.GET, vimeoAPIURL);

request.addQuerystringParameter("format", "json");
request.addQuerystringParameter("method","vimeo.videos.getUploaded";
request.addQuerystringParameter("user_id", "user137");
request.addQuerystringParameter("full_response", "true");
request.addQuerystringParameter("method","vimeo.videos.getThumbnailUrls");

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

Syso(response.getCode());
Syso(response.getBody());