Giter VIP home page Giter VIP logo

Comments (4)

dotansimha avatar dotansimha commented on May 27, 2024 4

@DxCx I know, and we had a discussion about it few months ago.
It's hard to maintain authentication with refresh tokens when using WebSocket connection, because validating it in during the construction of the connection is not enough sometimes, and validating it every message is probably too heavy.

In the ws transport with have both onConnect and onOperation, and I think that each application should choose the best flow and solution for itself.

from graphql-subscriptions.

dotansimha avatar dotansimha commented on May 27, 2024 1

@akaNightmare
I think this issue is more related to subscriptions-transport-ws package.
Since version 0.7.0 of the transport, you can specify onOperation and add custom logic to verify your token, then return a new context when each operation is executed.
You can see an example for this in GitHunt server example: https://github.com/apollographql/GitHunt-API/blob/master/api/server.js#L160

from graphql-subscriptions.

DxCx avatar DxCx commented on May 27, 2024

@dotansimha websocket is not like http,
http will need to reconstruct the session every request, but on websocket
context can be constructed once on connect phase and then you can keep the session,
onOperation should just attach this session..

from graphql-subscriptions.

grantwwu avatar grantwwu commented on May 27, 2024

If you're still having problems with this, please reply below... not quite sure if this is the right place for this.

from graphql-subscriptions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.