1

I'm using python-oauth2 to authenticate API calls to Dropbox's API.

There are two problems I'm having:

  1. I don't know how to provide a callback function to OAuth. I tried making the request as follows:

    resp, content = client.request(request_token_url,\
    "POST",body=urllib.urlencode({'oauth_callback':callbackURL}))
    

    However, the function at callbackURL is not called.

  2. At the moment, I've just modified the example code given in the README for python-oauth2, and I've managed to redirect the user to the Dropbox authentication page. However, I've written no code to explicitly sign my requests. Is that being done by the module, or are the requests I am making just unsigned? If its the latter, I'm really confused as to how things are working.

Help much appreciated. Thanks!

--Edit--

So I was reading the API docs, and the authorization URL takes two parameters - one is the access_token and the second is oauth_callback. I managed to created a URL that had these two parameters, and now, once the user authenticates my app, they are successfully redirected to my website. However, this seems like a very crude hack, and I'd love to learn to do this in a better way.

4

0 回答 0