You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The authorized_handler method raises OAuthException if the OAuth process fails. However, since this method is a decorator, there's no way to write an exception handler that can display a friendly error message to the user. Instead, the user sees a 500 internal server error.
I had to manually apply the decorator and it was a real pain.
I have 2 suggestions:
Split the decorators into 2 methods: one for the functionality, one which makes it a decorator. That way if one wanted to, one could easily just call the “functionality” method and just use its return value.
Have the decorators catch all exceptions which occur before calling the wrapped function, and if an exception is raised, just pass it to the wrapped function in a specific named argument. (Similar to Node callbacks.) The wrapped functions can then just check whether the error arg is not None and if so deal with it.
I wrapped the decorator with another decorator (trapping this very exception) but it's not ideal, I agree. It would be nice to have a authorize() method returning the data, or throwing whatever exception.
The
authorized_handler
method raises OAuthException if the OAuth process fails. However, since this method is a decorator, there's no way to write an exception handler that can display a friendly error message to the user. Instead, the user sees a 500 internal server error.Relevant code: https://github.com/mitsuhiko/flask-oauth/blob/master/flaskext/oauth.py#L305
The text was updated successfully, but these errors were encountered: