async-graphql / examples

217 stars 54 forks source link

[Axum] axum-token-from-header not working #77

Closed hffmnn closed 9 months ago

hffmnn commented 9 months ago

I have the same issue as described here with the axum example.

Screenshot 2023-11-25 at 16 52 44

When doing the same with poem-token-from-header it gives me

{
  "errors": [
    {
      "message": "Socket closed with event 1002 Token is required",
      "stack": "error@https://unpkg.com/graphiql/graphiql.min.js:71224:18\n../../../node_modules/graphql-ws/lib/client.mjs/createClient/subscribe/<@https://unpkg.com/graphiql/graphiql.min.js:20834:14\n"
    }
  ]
}

so I know I am already in the on_connection_init code. I guess my open question for this is then how to provide the correct payload to the on_connection_init method?

Any idea what might be wrong?

hffmnn commented 9 months ago

OK, got it, The payload has to look like this:

{
  "token": "123456"
}