graphql-elixir / plug_graphql

Plug (Phoenix) integration for GraphQL Elixir
Other
126 stars 7 forks source link

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

Closed harmon25 closed 8 years ago

harmon25 commented 8 years ago

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!

harmon25 commented 8 years ago

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