统一电路 OAuth2 - 为什么 Body return empty [] from REST API 请求?

Unify Circuit OAuth2 - Why does Body return empty [] from REST API requests?

当我使用我的 oauth 2.0 令牌尝试 REST API 时,我不断在 body 下返回空结果 [],在 [=81= 中返回 OK-200 状态代码].

我创建了一个机器人并使用 curl + 基本身份验证以及 swagger 测试了其余的 API,它们工作正常。我使用带有 swagger 令牌的 oauth 2.0 测试了我的 curl 命令,这也能正常工作。

我尝试了不同的设置来测试,但要坚持一个基础:

\Requesting token:
curl -X POST https://circuitsandbox.net/oauth/token -d "client_id=myclientidhere&client_secret=myclientsecrethere&grant_type=client_credentials&scope=READ_USER_PROFILE,WRITE_USER_PROFILE,READ_CONVERSATIONS,WRITE_CONVERSATIONS,READ_USER" -i

{"access_token":"myaccesstokenhere","token_type":"Bearer","scope":["READ_USER_PROFILE","WRITE_USER_PROFILE","READ_CONVERSATIONS","WRITE_CONVERSATIONS","READ_USER"]}

\Making request:
curl -i "https://circuitsandbox.net/rest/v2/conversations" -H "Authorization: Bearer myaccesstokenhere" -i
[]
\\Full sample (-i parameter):
\Requesting token:
curl -X POST https://circuitsandbox.net/oauth/token -d "client_id=myclientidhere&client_secret=myclientsecrethere&grant_type=client_credentials&scope=READ_USER_PROFILE,WRITE_USER_PROFILE,READ_CONVERSATIONS,WRITE_CONVERSATIONS,READ_USER" -i

HTTP/1.1 200 OK
Date: Sat, 22 Jun 2019 01:21:43 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 179
Connection: keep-alive
access-control-allow-origin: *
access-control-allow-credentials: true
access-control-allow-methods: GET, POST, DELETE, PUT, PATCH, OPTIONS
access-control-allow-headers: Accept, Accept-Language, User-Agent, Origin, Connection, Host, Accept-Encoding, Authorization, Content-Type, api_key, apiKey
ETag: W/"b3-K441G+yOERm+Qhj2E8VpkzO8ISg"
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Strict-Transport-Security: max-age=157680000; includeSubdomains; preload

{"access_token":"myaccesstokenhere","token_type":"Bearer","scope":["READ_USER_PROFILE","WRITE_USER_PROFILE","READ_CONVERSATIONS","WRITE_CONVERSATIONS","READ_USER"]}

\Making request:
curl -i "https://circuitsandbox.net/rest/v2/conversations" -H "Authorization: Bearer myaccesstokenhere"

HTTP/1.1 200 OK
Date: Sat, 22 Jun 2019 01:25:37 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 2
Connection: keep-alive
access-control-allow-origin: *
access-control-allow-credentials: true
access-control-allow-methods: GET, POST, DELETE, PUT, PATCH, OPTIONS
access-control-allow-headers: Accept, Accept-Language, User-Agent, Origin, Connection, Host, Accept-Encoding, Authorization, Content-Type, api_key, apiKey
ETag: W/"2-l9Fw4VUO7kr8CvBlt4zaMCqXZ0w"
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Strict-Transport-Security: max-age=157680000; includeSubdomains; preload

[]

我希望输出包括请求的 body 输出,例如

{"type":"COMMUNITY","convId":"5fad5fa4-1097-d66f-083a-3f129214e99f","participants":["5fad5fa4-1097-d66f-083a-3f129214e99f","5fad5fa4-1097-d66f-083a-3f129214e99f","5fad5fa4-1097-d66f-083a-3f129214e99f","5fad5fa4-1097-d66f-083a-3f129214e99f"],"topic":"YourCompany","creationTime":1560992185888,"modificationTime":1561143383261,"creatorId":"5fad5fa4-1097-d66f-083a-3f129214e99f","creatorTenantId":"5fad5fa4-1097-d66f-083a-3f129214e99f","description":"Default open conversation for YourCompanyHere"}

但实际输出是:[ ]

刚刚测试过,我得到的对话(和社区)returned.This 不会 return 你的对话,而是机器人所属的对话。确保机器人是对话的成员。

如上面的回复所述,这是我遗漏的一部分,即使将机器人添加到对话中,我仍然得到空白。我也遇到了各种奇怪的问题,例如尝试将旧机器人添加到新对话等时收到错误。原因是因为我为我的电路沙箱帐户和机器人使用了相同的 e-mail 地址,所以这可能造成了冲突。简而言之,这对我有用:

1.使用与我的沙盒帐户不同的 e-mail 地址创建了新的机器人(即使是假的 e-mail 也能工作)

2。通过 e-mail 地址将机器人添加到对话中(机器人名称没有将其拉起) - 谢谢@Roger

3。 运行创建token和使用API的命令相同,这次成功了!

帮助解决问题,发布并修复同事在不同沙箱中提出的问题(感谢 Ricky El-Qasem!),在 postman、curl 和 PowerShell 中测试。