Issue with authentication using jwt token in subscription
Could you please provide an example of how to call subscription using endpoint and the jwt authentication using email and api key . I am getting jwt token using resp = requests.post(ServerUrl, auth=(email,apiKey)) .
I tried the following options for subscriptions.
-
auth = HTTPBasicAuth(email, apiKey) client = GraphqlClient(endpoint="wss://xxxx/graphql",options={"auth": auth} ) asyncio.run(client.subscribe(query=query,variables={'id': 'xx'}, handle=callback))
-
resp = requests.post(ServerUrl, auth=(email,apiKey)) jwtToken = resp.json()['access_token'] client = GraphqlClient(endpoint="wss://xxxx/graphql") client.headers = {'Authorization': jwtToken} asyncio.run(client.subscribe(query=query,variables={'id': 'xx'}, handle=callback))
I am getting the following error in both the cases. websockets.exceptions.InvalidURI:xxx/graphql isn't a valid URI .
Thanks in advance, Renjila
you could use the integrated headers API found in the source code. headers={'Authorisation': "Baerer ... while init the GraphqlClient