senecajs / seneca-auth

A Seneca user authentication plugin for Hapi and Express
http://senecajs.org
MIT License
33 stars 29 forks source link

ACT_NOT_FOUND (plugin: auth) #108

Open davd33 opened 7 years ago

davd33 commented 7 years ago

Hello, I'm having the following issue:

Seneca Fatal Error

Message: seneca: No matching action pattern found for { plugin: 'auth', config: { prefix: '/auth', redirects: {} }, use: { prefix: '/auth', pin: { role: 'auth', cmd: '*' }, startware: [Function], map: { login: [Object], logout: [Object], register: [Object], instance: [Object], create_reset: [Object], load_reset: [Object], execute_reset: [Object], confirm: [Object], update_user: [Object], user: [Object], change_password: [Object] } }, role: 'web' }, and no default result provided (using a default$ property).

Code: act_not_found

Here's my code: https://gist.github.com/davd33/4bc128cf23df789fe2c0bc0b8a322422

How can I solve this issue?

Yuvaleros commented 7 years ago

Having the same issue, happened after updating to senecajs 3.2.2

augustine-tran commented 7 years ago

The same for me.

davd33 commented 7 years ago

Can someone look into this?

Yuvaleros commented 7 years ago

Hi, @mihaidma, @rjrodger
Is it possible to address this? I can't upgrade to the latest version of Senecajs unless this is fixed.

help will be much appreciated.

knasher commented 7 years ago

Having the same issue here too :(

knasher commented 7 years ago

It looks as though there was quite a fundamental change between seneca-web 0.8.0 and 1.0.0; I will take a look into what changes are needed for seneca-auth to work with the new version.

tswaters commented 7 years ago

Providing custom middleware to seneca-web, which this module does for initializing passport and the like, is no longer possible with the latest version of seneca-web .... it now has its own way to do auth that makes seneca-auth redundant, however it requires more configuration of the web server ahead of time to use it.

Both the express and hapi adapters support an auth key provided to routes, and additional config keys passed to the routemap which provide for additional configuration.

That said, in my own projects I usually use express and will configure the app myself with custom middleware attached to the seneca-web context and bypass the auth setup in seneca-web entirely. I prefer a more fine-grained approach that includes authorization, and response codes instead of redirects; as long as req.user is set, it will make its way to the seneca actions.

--

If you want to upgrade to the latest version of seneca, and still use seneca-auth, you can probably do so, but you'll need to stick to the old seneca-web -- if you have it installed as a dependency at version 0.8.x, seneca-auth should continue to work.... seneca 3 removed the 0.x seneca-web dependency -- but that's not to say you can't use it yourself. I haven' tested 0.x of seneca-web with seneca3, but I don't see why it wouldn't work.... Of course, going this route means you need to use the old seneca-web as well.

Yuvaleros commented 7 years ago

Thanks, @tswaters! I used the express + passport solution (took a bit of work but it works fine). I think this information should be added to the readme file.