如何使用 Basecamp 2 API 和 oAuth 2.0 作为最终用户发送评论
How use Basecamp 2 API with oAuth 2.0 to send a comment as end user
我想使用 Basecamp 2 API 作为最终用户从我的带有 oAuth 2.0 的应用程序发送评论。但我不明白我该怎么做。
我有 access_token,我可以作为管理员用户发送评论,但我不能像经理一样作为最终用户发送评论。
我该怎么做?
如果我尝试(我使用 python 和请求):
url = BASE_URL + '/projects/<my_project>/todos/<my_todos>/comments.json'
body = {
"content": "some text",
"creator": '18054825'
}
headers={'Content-Type': 'application/json; charset=utf-8',
'Authorization': 'Bearer ' + bc['access_token'],
'User-Agent': 'MyApp (example@email.com)',
'Accept': 'application/json'
}
r = requests.post(url=url, data=json.dumps(body), headers=headers)
r.status_code
我收到 422 错误
这是不可能的。 Basecamp 无法将别名设置为最终用户。
支持回答:
You need full OAuth2.0 authentication and you can only post through a
user's profile if you authenticator with their personal token:
https://github.com/basecamp/api/blob/master/sections/authentication.md
我想使用 Basecamp 2 API 作为最终用户从我的带有 oAuth 2.0 的应用程序发送评论。但我不明白我该怎么做。 我有 access_token,我可以作为管理员用户发送评论,但我不能像经理一样作为最终用户发送评论。 我该怎么做?
如果我尝试(我使用 python 和请求):
url = BASE_URL + '/projects/<my_project>/todos/<my_todos>/comments.json'
body = {
"content": "some text",
"creator": '18054825'
}
headers={'Content-Type': 'application/json; charset=utf-8',
'Authorization': 'Bearer ' + bc['access_token'],
'User-Agent': 'MyApp (example@email.com)',
'Accept': 'application/json'
}
r = requests.post(url=url, data=json.dumps(body), headers=headers)
r.status_code
我收到 422 错误
这是不可能的。 Basecamp 无法将别名设置为最终用户。
支持回答:
You need full OAuth2.0 authentication and you can only post through a user's profile if you authenticator with their personal token: https://github.com/basecamp/api/blob/master/sections/authentication.md