UPDATE
Try defining an errorhandler
(docs at http://flask.pocoo.org/docs/api/#flask.Flask.errorhandler), like this:
@app.errorhandler(500) # since exceptions will produce 500 errors
def error_handler(error):
if isinstance(error, SocialAuthBaseException):
return redirect('/error')
The solution below this line won't work
Try with a teardown_request
(http://flask.pocoo.org/docs/reqcontext/#teardown-callbacks), like this
@app.teardown_request
def teardown_handler(exception=None):
if exception and isinstance(exception, SocialAuthBaseException):
return redirect('/error')