How client to do Graphql subcription with a provided token?

1

Hi everyone,

Currently, I get a problem when designing a system that the client needs to watch real-time graphs from Amplify Backend with a provided token (client didn't log in with AWS Cognito).

Here are the steps I want:

Step 1: Client requires to subscribe data of graph with a provided token.

Step 2: Backend checks the token is legit or not and accepts the connection.

Step 3: Any modified data in backend data will be notified to the client

Step 4: The client will upload the graph.

Currently, my design is client sends REST APIs each period to get data with provided token and the backend must check provided token each period.

It had disadvantages because the client always send requests to the back-end.

I try to make the client do GraphQL subscription data from the backend with provided token but can't think any solution can handle it.

The demo solution I can do with socket.io + NodeJS.

https://github.com/hoan-pham-duy/socket-io-with-token

In the frontend, the user can enter to token to ask for a socket connection from the backend In the backend, it checks the token provided by the user and returns a socket connection if it's valid.

Hope so much for your suggestion!

Thank you so much for your help!

답변 없음

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠