Created
November 15, 2019 12:11
-
-
Save darahayes/89db4fd5877409e79511fde0280c78ed to your computer and use it in GitHub Desktop.
From my post on Keycloak auth in GraphQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Keycloak from 'keycloak-js' | |
import { WebSocketLink } from 'apollo-link-ws' | |
var keycloak = Keycloak({ | |
url: 'http://keycloak-server/auth', | |
realm: 'myrealm', | |
clientId: 'myapp' | |
}) | |
const wsLink = new WebSocketLink({ | |
uri: 'ws://localhost:5000/', | |
options: { | |
reconnect: true, | |
connectionParams: { | |
Authorization: `Bearer ${keycloak.token}` | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment