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

App level auth routes for multiple sub-routes #90

Closed
startupthekid opened this Issue Mar 2, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@startupthekid
Copy link

startupthekid commented Mar 2, 2016

I have an application with multiple mounted subapps, all feathers apps, that I need to provide authentication on. Each subapp is different; one uses feathers-rest, another feathers-socketio, and so on. By the current model, because I set app.use(rest()) and app.use(hooks()), on the subapps, not the parent app, I can't configure authentication on the parent level, even with something like this:

app
    .use('/api', apiRoutes)
    .use('/analytics', analyticsRoutes)
    .use('/authentication', authRoutes)
  .use('/payment', paymentRoutes)
  .configure(authentication({
    userEndpoint: '/api/users',
    token: {
      secret: config.JWT_SECRET
    },
    local: {
      usernameField: 'email'
    },
    facebook: {
      clientID: config.FACEBOOK_APP_ID,
      clientSecret: config.FACEBOOK_APP_SECRET,
      strategy: FacebookStrategy,
      tokenStrategy: FacebookTokenStrategy,
      permissions: {
        scope: ['email', 'public_profile']
      }
    }
  }));

where the authentication is configured after all the services have been registered. Am I stuck with setting up auth on each individual subapp or is there a way I can do it all one and done?

@daffl

This comment has been minimized.

Copy link
Member

daffl commented Mar 2, 2016

Currently probably yes. I think we'll need to be able to register services at the parent app level via feathersjs/feathers#216 for this to be possible.

@startupthekid

This comment has been minimized.

Copy link
Author

startupthekid commented Mar 2, 2016

Ok that's not terrible. That'd be nice if services were registered at the parent level, but not a huge deal for now. Also response time is just stellar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.