oauth - Dropbox auth is not working on Python -
i'm trying build app using python ( flask ) , dropbox api. i'm trying authorize user, followed tutorial python.
from flask import flask, render_template, url_for dropbox import client, rest, session # dropbox settings app_key = 'gb83a6gpdo4kba6' app_secret = 'w5q0yhj9ikiw39g' access_type = 'app_folder' # flask config debug = true app = flask(__name__) app.config.from_object(__name__) @app.route("/") def home(): dropboxaccount = dropboxaccesstoken = dropboxclient = none # dropbox auth dropboxsession = session.dropboxsession(app.config['app_key'], app.config['app_secret'], app.config['access_type']) requesttoken = dropboxsession.obtain_request_token() try: dropboxaccesstoken = dropboxsession.obtain_access_token(requesttoken) dropboxclient = dropboxclient.dropboxclient(dropboxsession) dropboxaccount = dropboxclient.account_info() except exception, e: print e dropboxauthurl = dropboxsession.build_authorize_url(requesttoken, oauth_callback = "http://localhost:5000/") context = { 'dropboxauthurl' : dropboxauthurl, 'dropboxaccount' : dropboxaccount } return render_template('layout.html', context = context) if __name__ == "__main__": app.run()
but, authorization isn't working. trying localhost, user clicks on link generated line:
dropboxsession.build_authorize_url(requesttoken, oauth_callback = "http://localhost:5000/")
and, go dropbox authorization page, displaying app info , options allow or refuse. when click in "allow" button, redirects me back, , when check account apps, new app isn't listed there. callback url looks this:
http://localhost:5000/dropbox/?uid={some_uid}&oauth_token={some_token}
anyone knows whats going on?
thanks in advance!
just solved. didn't notice reseting request_token on every request.
Comments
Post a Comment