Using OAUTH2 authentication in REST requests

Hi,

I wanted to use oauth2 based authentication to interact with REST server instead of Basic Auth method. How can I achieve this?

It’s been a while… have you succeeded in this task?
I’m using python requests module and I can run anything using either password or personal tokens. But I’d like to grant access to users using authorization code method. The documentation omits cURL examples for that and it seems that it doesn’t work as other applications do.

As far as I know I should do a POST (to what endpoint I don’t know, I thought it was /o/authorize/) with client_id and receive an authorization code. Then I should do a post to /applications//tokens/ with client_id, client_secret and authorization code to get a token. I may be missing something but I shouldn’t have to write my password in the client application, but no matter what I do I keep getting 401 error.

Have someone tried this?