def authorize_callback(request): code = request.GET['code'] access_token, user_id, url_state = get_flow(request).finish(request.GET) # generate random key that we will tie to this access token key = ''.join(random.choice(string.ascii_uppercase) for i in range(20)) # store reference to access token associated with key access_token = DropboxAccessToken.objects.create(key=key,access_token=access_token) # redirect to 'home' return redirect('authenticated_home', key=key)
def authorize(request): authorize_url = get_flow(request).start() return HttpResponseRedirect(authorize_url)