Ember simple auth 1.0. custom authenticator


#1

There is one problem,

I want to set the routeIfAlreadyAuthenticated route in environment as the route with dynamic segment(/:userid/dashboard) which is based on the logged-in user.

How can i do that?

//config/environment.js
  ENV['ember-simple-auth'] = {
    authorizer: 'authorizer:custom',

    routeAfterAuthentication: '/dashboard',
    routeIfAlreadyAuthenticated: '/dashboard'
  };

#2

Maybe create a dashboard route that redirects to “/:userid/dashboard”

Example:

// app/routes/dashboard.js
import Ember from 'ember';
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';

export default Ember.Route.extend(AuthenticatedRouteMixin, {
  session: Ember.inject.service('session'),

  activate() {
    var user_id = this.get('session.data.authenticated.user.id');

    this.transitionTo('/' + user_id + '/dashboard');
  }
});

This is more of a hack than a solution…