Authenticating Websockets
When it comes to authenticating websockets the token can be included only in the following manner:
wss://streaming.bitquery.io/graphql?token=ory*at*.. with the token attached to the URL. The request should include only two headers:
Sec-WebSocket-Protocol: graphql-ws
Content-Type: application/json
Refer this this link for postman example of how to use OAuth with websockets.
Example: connecting with graphql-ws (JavaScript)
Pass the OAuth token in the connection URL and use the graphql-ws subprotocol:
import { createClient } from "graphql-ws";
const client = createClient({
url: "wss://streaming.bitquery.io/graphql?token=ory_at_YOUR_TOKEN",
// Bitquery expects the token in the URL (not an Authorization header) for WebSockets.
});
- Generate the token in Account → API Access Tokens; see how to generate a token.
- Revoking a token does not close an already-open socket — terminate running subscriptions from the account panel.