graphql-elixir/plug_graphql

plug_graphql after `Guardian.Plug.VerifyHeader` not working as expected...

harmon25 opened this issue · 1 comments

Great library! Really digging GraphQL in Elixir/Phoenix with Ecto, but seem to have a problem with the plug in front of Guardian.Plug.VerifyHeader

Here is a snippet of the router that pipes graphql requests through an API endpoint which should include the guardian plugs...

 pipeline :api do
   plug :accepts, ["json"]
   plug Guardian.Plug.VerifyHeader, realm: "Bearer"
   plug Guardian.Plug.LoadResource
 end

 scope "/api" do
   pipe_through :api
   forward "/", GraphQL.Plug.Endpoint, schema: {MyApp.GraphQL.Schema, :schema}
 end

The GraphQL endpoint seems to respond to the requests even if there is no Authorization header.

Help is much appreciated, thanks!

OK was missing plug Guardian.Plug.EnsureAuthenticated, my bad! closing.