Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
foxo1
5 years agoExplorer | Level 4
OAuth2 via Python SDK and Django
Hi again,
So I'm trying to implement the non-pkce authorization via the Python SDK using DropboxOAuth2Flow with redirects.
View 1 creates the initial auth_flow object.
def dp_a...
Greg-DB
Dropbox Community Moderator
5 years agoI can't offer help for Django in particular, as that's made by Dropbox, but I'll be happy to offer whatever guidance I can in general.
First, I'll send this along as a feature request to make DropboxOAuth2Flow serializable though I can't promise if or when that might be implemented.
Anyway, you generally shouldn't need to serialize it though; you can just recreate it when needed. For instance, here's an example (albeit written for Flask, and for an older version of the Dropbox SDK, but the idea is the same) showing how the flow is recreated via the "get_flow" method, which is re-used in both steps.
- foxo15 years agoExplorer | Level 4
Hi Greg-DB!
Thanks again for your reply - it works perfectly now without any pickling or weird dictionary.
For anyone out there I'd like to share my code to help you out if need be:
@login_required def dropbox_authorization(request): auth_flow = dropbox.DropboxOAuth2Flow( _APP_KEY, _REDIRECT_URI, request.session, 'dropbox-auth-csrf-token', _APP_SECRET, _LOCALE, 'offline', use_pkce=False) return HttpResponseRedirect(auth_flow.start()) @login_required def dropbox_authorization_success(request): def _get_flow(request): return dropbox.DropboxOAuth2Flow( _APP_KEY, _REDIRECT_URI, request.session, 'dropbox-auth-csrf-token', _APP_SECRET, _LOCALE) result = _get_flow(request).finish(request.GET) request.user.dp_refresh_token = result.refresh_token request.user.save() request.session['access_token'], request.session['expires_at'] = result.access_token, result.expires_at.isoformat() return #to the view of your likingHope this helps!
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!