I have a scenario where I want one GraphQL resolver to be reached without first being authenticated (The Sign In Endpoint). But I can’t figure out how to separate the the authenticated and unauthenticated routes.
Here is my router:
ROUTER:
scope "/graphql/unauthenticated" do
pipe_through([:api])
forward "/", Absinthe.Plug, schema: StatcastersWeb.Schema
end
scope "/graphql" do
pipe_through([:api, :authenticated])
forward "/", Absinthe.Plug, schema: StatcastersWeb.Schema
end
ERROR:
Absinthe.Plug has already been forwarded to. A module can only be forwarded a single time.
I understand the error, but what do I do here? I want to have a place to tell GraphQL that this query doesn’t need to be authenticated. How can I achieve this?
Hi @apellizzn can you show your router code? If I had to guess you’re forwarding to the new plug in both cases when you should be forwarding to the normal plug once, and your new plug once.
@apellizzn hi both of you guys, I’m the same to you before, how about now?
With upgrading to the latest Phoenix 1.7.0, I’ve been fixing almost all of routers in my company’s Umbrella project. Could anyone help me, please?