riverrun / phauxth

Not actively maintained - Authentication library for Phoenix, and other Plug-based, web applications
409 stars 20 forks source link

Allowing authentication by either token or session for a given pipline #40

Closed acrolink closed 6 years ago

acrolink commented 6 years ago

I have tried:

  pipeline :api do
        plug :accepts, ["json"]
    plug :fetch_session
        plug Phauxth.Authenticate, method: [:token, :session], user_context: Beta.Users
  end

But failed with:

 no function clause matching in Phauxth.Authenticate.get_user/2
        (phauxth) lib/phauxth/authenticate.ex:35: Phauxth.Authenticate.get_user(%Plug.Conn{adapter: 
riverrun commented 6 years ago

You have to choose one or the other. I don't know what you are trying to achieve here. Do you want it to fallback to sessions under certain circumstances?

acrolink commented 6 years ago

I thought about, it needs indeed to be either way, should not be both.