Created
November 15, 2019 12:10
-
-
Save darahayes/7b9b97d05b0009af2bef03ce7c4205c7 to your computer and use it in GitHub Desktop.
From my medium post on Keycloak auth in GraphQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const resolvers = { | |
Subscription: { | |
commentAdded: { | |
subscribe: () => pubsub.asyncIterator(COMMENT_ADDED) | |
}, | |
messageAdded: { | |
subscribe: auth(() => pubsub.asyncIterator(COMMENT_ADDED)) | |
}, | |
alertAdded: { | |
subscribe: hasRole('admin')(() => pubsub.asyncIterator(ALERT_ADDED)) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment