smpallen99 / coherence

Coherence is a full featured, configurable authentication system for Phoenix
MIT License
1.27k stars 224 forks source link

Is Coherence ready to use with Phoenix 1.4.0-rc0? #386

Closed dimitarvp closed 5 years ago

dimitarvp commented 5 years ago

As per the title, do we have to do something extra if we want to use Coherence with Phoenix 1.4.0-rc0?

Also, is it a good idea to override Coherence's dependency on Phoenix? ("~> 1.3" at the moment)

To clarify, I use Phoenix like so right now:

      {:phoenix, "~> 1.4.0-rc", override: true},
smpallen99 commented 5 years ago

I have not tried phoenix 1.4.0 yet. So I cannot comment on its support. I'm in the middle of testing the new controller design branch on my active project. Once that's complete in the next couple days, I'll merge that branch and do some testing on phoenix 1.4.0.

atavistock commented 5 years ago

I can tell you my experience thus far, that its working for me now, and what I've changed to get it working.

  1. You must use 'override: true', otherwise many dependencies will break expecting a different version of pheonix versions. Obviously you will be able to back this out once other plugs catch up.

  2. The only thing that broken, is unfortuantely by an improvement in phoenix. Route helper links now expect you to explicitly call the Routing helper. That can be fixed by doing two things:

    • Add alias YourappWeb.Router.Helpers, as: Routes into lib/yourapp_web/coherence_web.ex
    • Now find every occurrence of route helpers, (e.g. session_path, registration_path, etc) and appending Routes. on them, so they look like Routes.session_path. For me it was enough to just find and replace the 8 or so path helpers.

I started putting together a pull request, but realized changing the generators is more quite a bit more complex than fixing my app. Also I think its a completely different task to cleanly fix an already installed setup of coherence (outside the generators). So maybe rather than fixing the generators there is simply a migration task that is run after the generators or it could be run independently on an existing installation.

smpallen99 commented 5 years ago

I'm testing coherence master with phoenix-1.4.0-rc.0 right now on a newly generated project. The only thing I have had to do so far is add override: true to the :phoenix dependency in mix.exs.

I'm not yet sure why @atavistock had an issue with lib/yourapp_web/coherence_web.ex router helpers. It already does a an import YourappWeb.Router.Helpers. The generated templates are working fine for me.

I've also tested YourappWeb.Coherence.ViewHelpers.coherence_links(@conn, :layout) in my layout and that's working fine too. I'll give another update after generating the controllers and trying a few more install options.

smpallen99 commented 5 years ago

I've tested registration, reset password, confirmation, unlock with token, trackable table, and generated controllers on a new coh install on a phx 1.4 project.

Again, the only thing needed is to override the Phoenix dependency in your project. From what I understand, this is because of the -rc tag. Once Phoenix goes full 1.4, we should be good to go.

BTW, I'm using Elixir 1.7.3. Coherence is compiling clean and all the project's generated files are compiling clean.

So, I'd say that there are no issue with Coherence and Phoenix 1.4 and Elixir 1.7.3.

atavistock commented 5 years ago

Circling back. When I create a completely clean install of Phoenix 1.4, add Coherence, and minimal setup (e.g. db credentials, coherence routes, etc), then I do not need to do anything with the route helpers. So this does look good as it is. Still not sure why I needed to make that change on my existing project, but no big deal.