我正在关注this设置Oauth。
我已经设置了公钥,下载了jar:
rest-oauth-client-1.0.one-jar.jar
rest-oauth-client-1.0-sources.jar
在页面上提到, 但在尝试执行时:
java -jar rest-oauth-client-1.0.one-jar.jar requestToken https://mycompanyname.atlassian.net
我收到一个奇怪的错误..我已经设置了消费者密钥。 错误是:
Jul 01, 2015 3:38:26 PM org.apache.http.impl.client.DefaultRequestDirector handleResponse
WARNING: Authentication error: Unable to respond to any of these challenges: {oauth=WWW-Authenticate: OAuth realm="https%3A%2F%2Fmycompanyname.atlassian.net", oauth_problem="consumer_key_unknown"}
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.simontuffs.onejar.Boot.run(Boot.java:340)
at com.simontuffs.onejar.Boot.main(Boot.java:166)
Caused by: java.lang.RuntimeException: Failed to obtain request token
at com.atlassian.oauth.client.example.AtlassianOAuthClient.getRequestToken(AtlassianOAuthClient.java:66)
at com.atlassian.oauth.client.example.JIRAOAuthClient.main(JIRAOAuthClient.java:52)
... 6 more
Caused by: net.oauth.OAuthProblemException: consumer_key_unknown
at net.oauth.client.OAuthResponseMessage.toOAuthProblemException(OAuthResponseMessage.java:83)
at net.oauth.client.OAuthClient.invoke(OAuthClient.java:306)
at net.oauth.client.OAuthClient.invoke(OAuthClient.java:260)
at net.oauth.client.OAuthClient.getRequestTokenResponse(OAuthClient.java:190)
at com.atlassian.oauth.client.example.AtlassianOAuthClient.getRequestToken(AtlassianOAuthClient.java:57)
... 7 more
有人可以帮我解决这个错误.. 请不要建议我this链接。我几次去过这份文件。 我一直在尝试使用python,但是我没有得到如何获取消费者的秘密。
答案 0 :(得分:2)
您的消费者密钥必须是"硬编码消费者"如果你想用jar rest -oauth-client-1.0.one-jar.jar获取令牌。
谢谢!