【问题标题】:Error in obtaining request token from JIRA in Oauth Process在 Oauth 过程中从 JIRA 获取请求令牌时出错
【发布时间】:2015-09-18 12:21:23
【问题描述】:

我正在关注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 做同样的事情,但我不知道如何获取消费者秘密。

【问题讨论】:

    标签: java python api rest oauth


    【解决方案1】:

    如果您尝试使用 jar rest-oauth-client-1.0.one-jar.jar 获取令牌,您的使用者密钥必须是“硬编码的使用者”。

    谢谢!

    【讨论】:

      猜你喜欢
      • 2014-12-26
      • 1970-01-01
      • 2015-04-19
      • 1970-01-01
      • 1970-01-01
      • 2021-10-31
      • 1970-01-01
      • 1970-01-01
      • 2018-12-27
      相关资源
      最近更新 更多