-
Notifications
You must be signed in to change notification settings - Fork 23
Subscription authentication #124
Comments
The issue presents the problem that doesn't apply to our library. The token is checked only at init and kept there. On the other hand there is no other reliable way to handle this properly.
GraphQL queries are not suited to handle secrets like token |
Yeah sorry, I am aware that the question was not specifically in the domain of If I am understanding correctly, using connection based tokens as it currently implemented will allow new subscriptions to initiated even though the token has expired? I am just wondering about the scenario:
Will Update: After some testing it appears the function hasRole returns |
If token is invalid (expiration is pretty low standard) subscription will not be initialized and rejected on query level. Strangely enough hasRole is not using token for its logic. |
I think I know what is happening your client is using the same ws connection for all queries. Authentication is done on Websocket level not query level. Meaning that your use case is right. I'm not sure about hasRole returning false for this - that is authorization level. There are couple ways to mitigate this if you are uberly concerned about expiration times. Sadly they are on the client side. We have been discussing couple times with team and we could not find any business case for doing it differently. If there is bug regarding token expiry affecting authorization it might be actually regression from last feature. Let's work on pinpointing it |
I tested this in kind of a crude method using the following scenario:
Where at the exp hasRole returns |
This very may well be a silly idea, but I'm going to shoot it out there anyways. There seems to be some obvious limitations around authentication via websocket connectionParams. If you're using a bearer token they're likely to expire quite frequently and you would be required to re-connect the websocket each time you renew the token. Not only would that interrupt existing subscriptions, not very efficient and a bit clunky.
Seems like a better approach would be to pass the bearer token as a parameter to the subscription query?
The text was updated successfully, but these errors were encountered: