Suggestion: More flexible redirect URI fetch in do_complete()
Not really an issue, more a suggestion.
First some praise: I only recently started using python-social-auth, and it's a joy! The separation of concerns is on point and the "pipeline" model is outstanding. So logical, flexible and understandable. I need to fetch a bunch of info beside user objects during the auth process, and once I figured stuff out, it was just a matter or extending the storage and backend classes, and adding a couple of pipeline functions. Kudos!
However, there is one particular part that is not quite as flexible as I would wish, and that is actions.do_complete(). Rather than mechanically redirecting to different static URLs defined in settings (I'm using Django), I need to dynamically generate the redirect URI based on a bunch of different attributes on the backend and strategy classes. Right now, I have solved it by subclassing BaseAuth, where I have added a get_complete_redirect_uri() method, which is called by the same class's setting() if name.endswith("_URL"), but that really feels like a hack. I also don't want to override do_complete() entirely, because that is bound to cause trouble with future updates. Neither could I inject the redirect URI into the session data and have do_complete() fetch it to redirect_value, because I might also want to set e.g. settings.NEW_USER_REDIRECT_URL for non-social-auth use, and in that case this value would take precedence.
My humble suggestion would be adding a method such as strategy.get_complete_redirect_uri(backend, user, is_new, ...) and have do_complete() call that one in the first hand, and only use the settings URLs if it returns a falsy value. Or is there already a clever solution that has escaped me?