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
{{ message }}
This repository has been archived by the owner on Jul 3, 2019. It is now read-only.
from graphql import GraphQLError
def login_required(function):
"""
use this decorator for mutations that require an
authenticated user
"""
def function_wrapper(*args, **kwargs):
info = args[1]
if info.context.user.is_authenticated:
return function(*args, **kwargs)
else:
raise GraphQLError("unauthenticated")
return function_wrapper
How would you handle a "login required" functionality with this approach?
The text was updated successfully, but these errors were encountered: