Jive REST API 使用基本身份验证返回 {"code":401,"message":"Bad credentials"}

Jive REST API returning {"code":401,"message":"Bad credentials"} using Basic Auth

这可能不是特定于 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(无论如何,我都拥有 "Full Access" 权限)。为什么会抛出 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

对于偶然发现此问题的任何人,user/password 凭据都很好 - 我只是将请求发送到错误的实例 https://sandbox.jiveon.com。这是针对从 Jive 迁移的客户,我们在 UAT 实例上提供了用户帐户,但您似乎无法使用此类帐户从沙箱实例接收响应。

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

帐户上的沙盒 jive 的基本身份验证不再有效。你可以尝试Oauth 2.0认证来访问jive rest api.

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

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

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

You can't use a federated user account to authenticate your API calls. You must create a non-federated, 'system' account that you can use to authenticate API calls.

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