def oauth_required(f):
        """
        decorator to add to a view to require an oauth user
        :return: decorated function
        """
        @wraps(f)
        def decorated_function(*args, **kwargs):
            if 'oauth_user_uri' not in session or session['oauth_user_uri'] is None:
                return redirect(url_for('.r_oauth_login', next=request.url))
            return f(*args,**kwargs)
        return decorated_function