pythonapioauth-2.0python-requestsbasecamp

How use Basecamp 2 API with oAuth 2.0 to send a comment as end user


I want to use Basecamp 2 API to send a comment as end user from my app with oAuth 2.0. But I don't understand how can i do this. I have access_token, I can send comment as admin user, but i can't send comments as end user like a manager. How can I do it?

if I try (I use python and requests):

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

I got 422 ERROR


Solution

  • This is impossible. Basecamp can't set alias as end user.

    Support answer:

    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