-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to get context for subscriptions #1553
Comments
please review this and see if it is a duplicate: #1526 (comment) |
@sbrichardson @martijnwalraven I am not sure, may be there's another way for my specific use case. What I want to achieve is using header tokens verify that the user has permissions for a certain room, or another use case to deliver private chat message between two users. Subscription can have variables that I can compare with payload like mentioned in examples but how can I verify that the user has permission to these variables. That is if a user subscribes using ... |
So, at the moment I found a hacky way to solve this. I could not find any other way to solve this yet. Also, this solution works only because I am using jwt token based api's. I currently have the following inside the withfilter:
And to subscribe, we need to do:
So basically, This is definitely a hacky way. Right from the start I can already see that it is a slight annoyance to send token in header as well as the query. But a bigger issue is that, when many users are subscribed to this 'SOMETHING_CHANGED' subscription, and if one user gets a notification, jwt is checked over all subscribed users. This I am guessing may affect performance. |
Solved by #1597 (comment) |
I have the following code:
And then in the subscription resolver
I cannot seem to send the username from onConnect to the context within withFilter. I am trying to achieve this because once I have the context (i.e. headers/auth), I want to compare it to the payload.
The text was updated successfully, but these errors were encountered: