Closed axelclark closed 6 years ago
I encountered the same problem. In my case it meant that I didn't have configured routes properly. There is a section in the README:
# lib/my_project_web/router.ex
defmodule MyProjectWeb.Router do
use MyProjectWeb, :router
use Coherence.Router # Add this
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
plug Coherence.Authentication.Session # Add this
end
pipeline :protected do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
plug Coherence.Authentication.Session, protected: true
end
# Add this block
scope "/" do
pipe_through :browser
coherence_routes()
end
# Add this block
scope "/" do
pipe_through :protected
coherence_routes :protected
end
scope "/", MyProjectWeb do
pipe_through :browser
get "/", PageController, :index
# add public resources below
end
scope "/", MyProjectWeb do
pipe_through :protected
# add protected resources below
resources "/privates", MyProjectWeb.PrivateController
end
end
@Kukunin Thanks! I checked and my router appears to be correct.
However, I discovered I needed to add a web_module
to my :coherence
config. The function below wasn't returning anything for Config.web_module
.
# lib/coherence/plugs/authorization/utils.ex
def new_session_path(conn) do
Module.concat(Config.web_module, Router.Helpers).session_path(conn, :new)
end
I'm attempting to update my coherence version from 0.3 to 0.5. I've followed the update instructions to 0.4, but I'm getting the following error:
I've looked through the diff after I generated the new boilerplate and I can't find anything that I think would cause the error. I'm using Phoenix 1.3, but I haven't transitioned all of my files/modules to the new naming convention and folder structure.
Any idea what the issue is? Thanks!