Skip to content

Issue with authentication using jwt token in subscription #49

@RenjilaRajan

Description

@RenjilaRajan

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.

  1. auth = HTTPBasicAuth(email, apiKey)
    client = GraphqlClient(endpoint="wss://xxxx/graphql",options={"auth": auth} )
    asyncio.run(client.subscribe(query=query,variables={'id': 'xx'}, handle=callback))

  2. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions