Scribe (Java)와 함께 Oauth Vimeo
문제
참고 : 웹 서비스와 인터페이스하는 방법을 설명하는 장소로 향하게 하여이 작업을 도와 드릴 수 있습니다. 그러나이 특정 문제에 대한 도움이 크게 감사 할 것입니다!
oauth가 작동하는 방식을 이해하는 데 정말 힘든 시간을 보내고 있습니다. Vimeo에서 계정에 대한 많은 비디오를 업로드하는 데스크톱 응용 프로그램을 개발하려고합니다. 나는 와 예제 . Scribe는 불행히도 Vimeo 예제가 없으므로 Facebook 예제를 변경하여 Vimeo에서 작동하도록 노력해 왔습니다. 이 모든 작업이 어떻게 작동하는지에 대한 정보가 거의 없습니다 (내가 찾을 수있었습니다 : 2 : 2 : 이해할 수 있음). 여기에 코드와 오류가있는 것만 큼 :
public class VimeoTest
{
private static final String NETWORK_NAME = "Vimeo";
private static final Token EMPTY_TOKEN = null;
public static void main(String[] args)
{
// Replace these with your own api key and secret
String apiKey = "MYAPIKEY";
String apiSecret = "MYAPISECRET";
OAuthService service = new ServiceBuilder()
.provider(VimeoApi.class)
.apiKey(apiKey)
.apiSecret(apiSecret)
.build();
Scanner in = new Scanner(System.in);
System.out.println("=== " + NETWORK_NAME + "'s OAuth Workflow ===");
System.out.println();
OAuthRequest orequest = new OAuthRequest(Verb.GET, "http://vimeo.com/api/rest/v2");
orequest.addQuerystringParameter("method", "vimeo.test.null");
Response send = orequest.send();
System.out.println(send.getBody());
// Obtain the Authorization URL
System.out.println("Fetching the Authorization URL...");
Token requestToken = service.getRequestToken();
//Breaks on the line above.
//But I think it's because the orequest.send() returned a 100 error code
String authorizationUrl = service.getAuthorizationUrl(requestToken);
System.out.println("Got the Authorization URL!");
System.out.println("Now go and authorize Scribe here:");
//I do NOT want to have to do this. Is there any other way I can have this authorize without going to a web browser to do this?
System.out.println(authorizationUrl);
System.out.println("And paste the authorization code here");
System.out.print(">>");
Verifier verifier = new Verifier(in.nextLine());
System.out.println();
.
출력 및 오류가 있습니다 :
=== Vimeo's OAuth Workflow ===
1.0
<?xml version="1.0" encoding="utf-8"?>
<rsp generated_in="0.0069" stat="fail">
<err code="100" expl="The API key passed was not valid" msg="Invalid API Key" />
</rsp>
Fetching the Authorization URL...
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/codec/binary/Base64
at org.scribe.services.HMACSha1SignatureService.doSign(HMACSha1SignatureService.java:47)
at org.scribe.services.HMACSha1SignatureService.getSignature(HMACSha1SignatureService.java:33)
at org.scribe.oauth.OAuth10aServiceImpl.getSignature(OAuth10aServiceImpl.java:118)
at org.scribe.oauth.OAuth10aServiceImpl.addOAuthParams(OAuth10aServiceImpl.java:63)
at org.scribe.oauth.OAuth10aServiceImpl.getRequestToken(OAuth10aServiceImpl.java:43)
at autouploadermodel.VimeoTest.main(VimeoTest.java:38)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.codec.binary.Base64
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 6 more
Java Result: 1
.
어쨌든, 이것은 이것이 정말로 간단하지만 웹 서비스와 인터페이스하는 방법을 이해하지 못합니다. 도움을 주셔서 감사합니다!
해결책
을 포함시켜야합니다
제휴하지 않습니다 StackOverflow