Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple Auth for same Authentication Scheme #73

Closed
anantab opened this issue Nov 22, 2017 · 4 comments
Closed

Multiple Auth for same Authentication Scheme #73

anantab opened this issue Nov 22, 2017 · 4 comments
Assignees

Comments

@anantab
Copy link

anantab commented Nov 22, 2017

Is it possible to use same authentication scheme like session and have separate auth with multiple tables, for example for admin section and customer section. Or could it be session for admin and jwt for customer section?

@hoangmy92
Copy link

@anantab
In the core of framework, they tried to find the suitable authentication provider (which was set on config/auth)
https://github.com/adonisjs/adonis-auth/blob/1.0.7/middleware/Auth.js#L29

So you just need to change the authenticator and it should work
http://www.adonisjs.com/docs/3.2/authentication#_switching_between_authenticators

@thetutlage thetutlage self-assigned this Jan 6, 2018
@thetutlage
Copy link
Member

Closing since no response from the issue reporter and not actionable as well

@mdjamilaj
Copy link

how to add multiple authenticator

@mcordoba
Copy link

mcordoba commented Jun 13, 2020

Im doing something like this:

  jwt_customer: {
    serializer: 'lucid',
    model: 'App/Models/Customer',
    scheme: 'jwt',
    uid: 'email',
    password: 'password',
    options: {
      secret: Env.get('APP_KEY')
    }
  },

  jwt_user: {
    serializer: 'lucid',
    model: 'App/Models/User',
    scheme: 'jwt',
    uid: 'email',
    password: 'password',
    options: {
      secret: Env.get('APP_KEY')
    }
  },

Then, Im trying to switch between authenticators as specified here:
https://adonisjs.com/docs/4.1/authentication#_switching_authenticators

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants