【问题标题】:Jive REST API returning {"code":401,"message":"Bad credentials"} using Basic AuthJive REST API 使用基本身份验证返回 {"code":401,"message":"Bad credentials"}
【发布时间】:2015-06-05 06:57:30
【问题描述】:

这可能不是特定于 Jive API,而是一般的基本身份验证。

这不是联合帐户。

我正在尝试使用 cURL 向 Jive REST API v3 发出简单请求:

curl --include --verbose --user {USERNAME}:{PASSWORD} 'https://sandbox.jiveon.com/api/core/v3/search/contents?filter=search(test)'

我也试过了:

curl -v -u USERNAME "https://sandbox.jiveon.com/api/core/v3/contents?count=100&startIndex=200"

我可以使用我的凭据登录 UI(无论如何,我仍然拥有“完全访问”权限)。为什么会抛出 401?我的身份验证格式不正确吗?

这是我正在关注的示例:

https://developer.jivesoftware.com/rest

以下是相关结果:

Trying 23.221.10.251...
Connected to sandbox.jiveon.com (23.221.10.251) port 443 (#0)
TLSv1.0, TLS handshake, Client hello (1):
TLSv1.0, TLS handshake, Server hello (2):
TLSv1.0, TLS handshake, CERT (11):
TLSv1.0, TLS handshake, Server finished (14):
TLSv1.0, TLS handshake, Client key exchange (16):
TLSv1.0, TLS change cipher, Client hello (1):
TLSv1.0, TLS handshake, Finished (20):
TLSv1.0, TLS change cipher, Client hello (1):
TLSv1.0, TLS handshake, Finished (20):
SSL connection using TLSv1.0 / AES128-SHA
Server certificate:
     subject: OU=Domain Control Validated; OU=COMODO SSL Wildcard; CN=*.jiveon.com
 start date: 2014-06-23 00:00:00 GMT
 expire date: 2015-07-31 23:59:59 GMT
 subjectAltName: sandbox.jiveon.com matched
 issuer: C=GB; ST=Greater Manchester; L=Salford; O=COMODO CA Limited; CN=COMODO SSL CA 2
 SSL certificate verify ok.
Server auth using Basic with user 'USERNAME OMITTED HERE'
GET /api/core/v3/contents?count=100&startIndex=200 HTTP/1.1
Authorization: Basic xxxxxxxxxxxxxxxxxx= (I verified this decoded properly in base64)
User-Agent: curl/7.41.0
Host: sandbox.jiveon.com
Accept: */*

HTTP/1.1 401 Unauthorized

【问题讨论】:

  • 您的密码是否包含任何可能导致问题的特殊字符?
  • 不 - 所有小写字母。

标签: curl basic-authentication restful-authentication http-status-code-401 jive


【解决方案1】:

对于任何偶然发现这一点的人,用户/密码凭据都很好 - 我只是将请求发送到错误的实例 https://sandbox.jiveon.com。这适用于从 Jive 迁移的客户,我们获得了 UAT 实例上的用户帐户,但您似乎无法使用此类帐户接收来自沙盒实例的响应。

将请求发送到https://{OUR JIVE ORG URL}/api/core/v3 工作正常。

【讨论】:

    【解决方案2】:

    对于沙盒 jive 帐户,基本身份验证不再有效。您可以尝试使用 Oauth 2.0 身份验证来访问 jive rest api。

    点击此链接以获取有关 jive oauth 身份验证过程的详细信息。 http://www.codefixup.com/how-to-authenticate-jive-rest-api-using-add-on/

    本教程肯定会解决您的问题....

    【讨论】:

    【解决方案3】:

    为了将来的故障排除,还会显示错误 401 Unauthorized, 当 Jive 实例配置了 SSO 登录,并且您使用联合用户帐户进行 API 调用时。

    您不能使用联合用户帐户来验证您的 API 调用。您必须创建一个可用于验证 API 调用的非联合“系统”帐户。

    来源:https://community.jivesoftware.com/thread/273582

    【讨论】:

      猜你喜欢
      • 2018-09-10
      • 1970-01-01
      • 2018-05-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-06-08
      相关资源
      最近更新 更多