Prisma1: Support authorization middleware for WSS connections

Created on 19 Jul 2017  路  6Comments  路  Source: prisma/prisma1

subscription-transport-ws uses a middleware concept for new connection parameters without requiring the client to be restarted. Here's an example of how that works.

Currently, Graphcool subscriptions only support sending the token when initializing the WS client, but should support the middleware approach as well.

A current workaround for setting the Authorization token after the app has been loaded is to persist the token after login into local storage or similar, and then reload the website.

aresubscriptions

All 6 comments

in auth case @marktani and extend JWT WebSocket security level we should remember about refresh token challange to keep state Autohorized

    applyMiddleware(operationOptions, next) {
     [if not expired]
      operationOptions["Authorization"] = returnJWT();
    [else]
      operationOptions["Authorization"] = returnJWTChalange(operationOptions["RefreshToken"])
   [end]
      next();
    }
  }
]);

still im @WIP on it

Any updates on this?

@marktani Is there any way at the moment to send Authorization token to Graphcool? If yes, please provide a working example for react-native.. Thank you

Yes, the way it always worked: https://www.graph.cool/forum/t/authentication-issues-with-subscriptions/45/2?u=nilan

This feature request is about _changing_ the authorization token _after_ initialing the subscription client.

Well, yes, but that's like 90% of the use cases.. it seldom you have the token when you initialize the client..

Sorry if I sounded angry yesterday but I lost my mind trying to configure the websockets permissions even with the example above and settings everything to public.. I ended up creating a new project from scratch to make it work

This issue has been moved to graphcool/graphcool-framework.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thomaswright picture thomaswright  路  3Comments

ragnorc picture ragnorc  路  3Comments

dohomi picture dohomi  路  3Comments

schickling picture schickling  路  3Comments

schickling picture schickling  路  3Comments